【问题标题】:td-agent is unable to ship logs from file when the file contains a single multiline log当文件包含单个多行日志时,td-agent 无法从文件中发送日志
【发布时间】:2019-09-08 18:12:15
【问题描述】:

当日志文件包含单个多行日志时,td-agent 无法从行发送日志。在添加新行之前,td-agent 不会获取日志

在 Windows 机器上安装了 td-agent。将 td-agent.conf 文件配置为从包含单个多行日志的文件中选择日志。在向文件中添加新行之前不会发送日志

td-agent.conf

<source>
    @type tail
    path "C:/abc.txt"
    pos_file etc/td-agent/pos/abc-file.pos
    tag abc-file-test
    multiline_flush_interval 5s
    format multiline
    <parse>
        @type multiline
        format_firstline /^2019*/
        format1 /^(?<message>.*)/
    </parse>
    read_from_head true
</source>

<filter abc-file-**>
    @type record_modifier
    <record>
        entity "abc"
        component ${tag}
        hostname "#{Socket.gethostname}"
    </record>
</filter>

<match abc-file-**>
    @type kafka_buffered
    brokers "localhost:9092"
    default_topic abc-topic
    flush_interval 5s
    kafka_agg_max_bytes 1000000
    max_send_limit_bytes 10000000
    discard_kafka_delivery_failed true
    output_data_type json
    compression_codec gzip
    max_send_retries 1
    required_acks 1
    get_kafka_client_log true
</match>

abc.txt 日志文件:

2019-04-12 12:09:45 INFO abc.java 异常发生在 com.************* 在 com.****************************** 在 com.************************

日志应该流向kafka,但它没有

【问题讨论】:

    标签: elastic-stack fluentd efk td-agent


    【解决方案1】:

    这是in_tail插件的限制。 将fluent-plugin-concatmultiline_end_regexp 参数一起使用怎么样?

    【讨论】:

    • 我尝试使用 concat 插件,但效果不佳。在输入换行符时,日志会被发送。
    • 你检查separator concat 插件的参数了吗?
    猜你喜欢
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-29
    • 2022-10-15
    • 1970-01-01
    • 2014-11-17
    相关资源
    最近更新 更多