Today I found out about, and tried out filebeat for sending logs to Elasticsearch via Logstash, which I already had set up. It seemed to work fine for a bit, until I noticed that FB stops sending logs after a period of activity.
Here's my setup:
- Ubuntu 14.04
- Filebeat 1.2.2
- Logstash 2.2
- Elasticsearch 1.5.2
Using tcpdump I determined that the instance running Filebeat had completely stopped sending data to the logstash instances, so I then turned on debug logging in Filebeat and discovered that it thinks the logs it's watching are not being updated, even though they are.
I primarily noticed this with my apache logs which are constantly receiving traffic. However, Filebeat reports:
2016-05-06T22:55:25Z DBG scan path /var/log/apache2/access.log
2016-05-06T22:55:25Z DBG Check file for harvesting: /var/log/apache2/access.log
2016-05-06T22:55:25Z DBG Update existing file for harvesting: /var/log/apache2/access.log
2016-05-06T22:55:25Z DBG Not harvesting, file didn't change: /var/log/apache2/access.log
I notice that apache constantly updates the modification time on access.log as it writes to it, and I assume the same happens with the other logs I'm monitoring. It appears that Filebeat is getting confused by this behaviour.
I did some googling and found that this seems to have been a problem for others, but so far I haven't found a solution. I tried setting 'spool_size: 1' for each prospector, but it did nothing. I also set registry_file: .filebeat for each prospector, this is the output of it:
I've tried watching this file to see if it changes, but it doesn't. If I restart filebeat it works for a short while and then starts showing that "Not harvesting, file didn't change" error.
Does anyone have a solution for this?