有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Fluentd尾部log4j文件设置

我们有一个基于Java的企业应用程序,它使用log4j生成日志,我们希望使用Fluentd和Elasticsearch以及Kibana,如here所述。 我想将Fluentd配置为转发现有日志,而不使用新的日志。我相信我们希望使用type tail,这样我们就可以将Fluentd指向正确的文件,但我认为我们需要一些关于如何正确配置td-agent.conf的示例


共 (2) 个答案

  1. # 1 楼答案

    我正在使用下面的td代理。apache访问日志的配置文件。根据解析器中的日志格式更改格式。rb。就我而言。rb-in/opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.12.7/lib/fluent/parser。rb

    <source>
     @type tail
     format apache
     tag apache.access
     path /var/log/httpd/access_log
    </source>
    
    
    <match apache.access>
     type stdout
    </match>
    

    stdout是td代理中的打印输出。日志因此,首先确保它在td代理中打印日志文件的尾部。日志获得成功后,你可以随心所欲地更换匹配标签

    祝你好运

  2. # 2 楼答案

    Fluentd有一个名为:in_tail的输入插件

    The in_tail Input plugin allows Fluentd to read events from the tail of text files. Its behavior is similar to the tail -F command.

    通过提供基于日志模式的格式正则表达式,可以将其配置为解析日志