向Fluentd发送TCP数据包

问题描述 投票:0回答:1

在我的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)的工具,如 telnetnetcat. 但终端连接到端口后就不返回了。它停留在那里没有任何响应。

检查了telnet netcat的verbose。没有结果。

我希望 TCP 连接并获取数据登录 fluentd 日志。但是连接建立了,但是数据没有写入日志,或者tcp连接的控制没有返回到终端。

tcp splunk fluentd
1个回答
0
投票

在你的conf文件中添加以下内容。

<source>
  @type forward
  port 24224
  bind 0.0.0.0
</source>

https:/docs.fluentd.orginputforward)。

© www.soinside.com 2019 - 2024. All rights reserved.