doushi8599 2016-02-03 14:04
浏览 485
已采纳

使用旧注册表使Filebeat从旧文件偏移开始

I'm running Filebeat (used to be know as "logstash-forwarder") on a docker container using prima/filebeat image.

The log files are located in a volume loaded to the container and I want to be able to remove the container and rerun it without it re-sending the logs to the logstash.

I tried to load the /.filebeat registry file as a volume so it will be reloaded on startup but all I get are these errors:

2016/02/03 13:47:29.107457 file_other.go:39: ERR Rotate error: rename /.filebeat.new /.filebeat: device or resource busy
2016/02/03 13:47:29.107788 registrar.go:105: ERR Writing of registry returned error: rename /.filebeat.new /.filebeat: device or resource busy. Continuing..

Does anybody happen to know how to do such a thing?

  • 写回答

1条回答 默认 最新

  • dongtan9518 2016-09-09 11:04
    关注

    With Filebeat version 1.2.3 (other versions may be the same, version 1.3 just came out a few days ago and I've not tried it yet) you will need to specify the path to the registry file. The registry file is the file where Filebeat keeps it read offset (in other words, the current read point in the log(s) file(s) it is processing).

    You need to specify the registry path in your filebeat.yml file, after the prospectors section.

    Something like:

    filebeat:
      prospectors:
        -
          document_type: wildfly-server
          input_type: log
          paths:
            - /path/to/my/log.log
          multiline:
             pattern: 'your pattern'
             negate: true
             match: after
    
      registry_file: /data/.filebeat
    
    logging:
      level: debug
      to_syslog: true
    
    output:
      logstash:
        hosts:
          - "127.0.0.1:5000"
    

    Then in your docker compose file you need to mount a volume pointing to your registry_file path. Something like:

    filebeat:
      image: prima/filebeat:latest
      volumes:
         - /data/filebeat:/data
      hostname: qa
    

    Then you should see in the host the .filebeat file located in the /data/filebeat folder.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog