在我的Mac OS中,我使用fluentd
尝试读取tcp事件并将其写入本地目录。
下面是我创建的用于打开TCP端口并写入本地的td-agent.conf
。
<!-- td-agent.conf-->
<source>
@type tcp
@log_level "trace"
tag "tcp.events"
port 2201
bind "0.0.0.0"
delimiter "\\n"
<parse>
@type "regexp"
expression "/^(?<field1>\\d+):(?<field2>\\w+)$/"
</parse>
</source>
<match tcp.events>
@type file
path "/Users/logs/outputlog"
<buffer time>
path "/Users/logs/outputlog"
</buffer>
</match>
为了测试,我正在使用2201
和telnet
之类的工具将tcp软件包发送到端口(netcat
)。但是终端连接到端口后不会返回。它停留在那里,没有任何回应。
检查telnet / netcat的详细信息。没有运气。
我希望TCP
能够连接并获取记录在fluentd
日志中的数据。但是已建立与端口的连接,但数据未写入日志或tcp连接的控制未返回给终端。
答案 0 :(得分:0)
将以下内容添加到您的conf文件中。
<source>
@type forward
port 24224
bind 0.0.0.0
</source>