1、下载地址
https://td-agent-package-browser.herokuapp.com/5/windows
选择LTS版本

2、配置路径
D:\fluentd\fluent\etc\fluent\fluentd.conf

3、运行

D:\fluentd\fluent\fluentd

样例1: 配置检测tail文件输入, 并打印终端.

<source>
  @type tail
  path D:\logs\users_view-2025-04-24.log
  pos_file D:\tmp\my-user-view.log.pos
  tag my.user_view
  <parse>
    @type none
  </parse>
</source>

<match my.*>
  @type stdout
  <format>
    @type single_value
  </format>
</match>

样例2: 配置检测tail文件输入,输出到hdfs. (官方文档
步骤一:首先安装webhdfs插件

D:\fluentd\fluent\fluent-gem install fluent-plugin-webhdfs

步骤二: hadoop的hdfs-site.xml文件,增加以下配置

<property>
  <name>dfs.webhdfs.enabled</name>
  <value>true</value>
</property>

<property>
  <name>dfs.support.append</name>
  <value>true</value>
</property>

<property>
  <name>dfs.support.broken.append</name>
  <value>true</value>
</property>

步骤三:fluentd.conf,增加以下配置

<source>
  @type tail
  path D:\tmp\user_views.log
  pos_file D:\tmp\user_views.log.pos
  tag my-log.user_view
  <parse>
    @type none
  </parse>
</source>

<match my-log.*>
  @type webhdfs
  host 10.0.8.10
  port 9870
  path "/test/user_views.log"
  <buffer>
    # 设置同步间隔
    flush_mode interval 
    flush_interval 10s
  </buffer>
  <format>
    @type single_value
  </format>
</match>


标签: none

添加新评论

icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif