【问题标题】:Content repeat collecting problems while use filebeat使用filebeat时内容重复收集问题
【发布时间】:2017-10-16 16:16:01
【问题描述】:

最近我们会使用filebeat来收集我们的系统日志到elasticsearch vias:

${local_log_file} -> filebeat -> kafka -> logstash -> elasticsearch -> kibana

在测试我们的系统时,我们发现filebeat会重复收集日志的场景,这意味着一旦有更改,它将从文件开头收集日志。

这是我对 filebeat 的配置:

filebeat.prospectors:

- input_type: log
  paths:
    - /home/XXX/exp/*.log

scan_frequency: 1s
#tail_files: true
#================================ Outputs =====================================
#----------------------------- Logstash output --------------------------------
# output.logstash:
#   hosts: ["localhost:5044"]

#----------------------------- Kafka output -----------------------------------
output.kafka:
  enabled: true
  hosts: ["10.10.1.103:9092"]
  topic: egou

#----------------------------- console output --------------------------------
output.console:
  enabled: true
  pretty: true

注意:

  1. 我们手动构建日志文件,我们确定文件末尾有一个空行
  2. 要制作控制台,我们打开 output.console
  3. 一旦有内容附加到日志文件的末尾,filebeat 将从文件的开头收集。但我们希望只是获取文件的更改。
  4. filebeat 版本为 5.6.X

希望大家多多指教

【问题讨论】:

  • 它适用于从 logback 或基于 slf4J 的工具收集的实时日志文件

标签: elasticsearch filebeat


【解决方案1】:

我认为这是因为您正在使用的编辑器在保存时创建了一个带有新元数据的新文件。 Filebeat 使用其元数据而非内容来识别文件的状态。

试试,

echo "something" >> /path/to/file.log

参考:https://discuss.elastic.co/t/filebeat-repeatedly-sending-old-entries-in-log-file/55796

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    相关资源
    最近更新 更多