在我的Mac OS中,随着 fluentd
我想读取tcp事件并将其写入本地目录。
下面是 td-agent.conf
以打开TCP端口并写入本地。
<!-- 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>
为了测试,我将tcp包发送到该端口(2201
)的工具,如 telnet
和 netcat
. 但终端连接到端口后就不返回了。它停留在那里没有任何响应。
检查了telnet netcat的verbose。没有结果。
我希望 TCP
连接并获取数据登录 fluentd
日志。但是连接建立了,但是数据没有写入日志,或者tcp连接的控制没有返回到终端。
在你的conf文件中添加以下内容。
<source>
@type forward
port 24224
bind 0.0.0.0
</source>