Hi,
I have a question regarding the close_inactive status and rolling files configuration of Filebeat.
I currently have Filebeat shipping some apache logs.
Apache Log entries can come in every 2 seconds as well as every 48 hours (This is a test environment that is not heavily used).
There is a rolling mechanism gzipping access_log file every day.
Currently the Filebeat configuration is using the default 5m close_inactive settings.
filebeat.inputs:
- type: log
paths:
- "/var/log/httpd/access_log"
fields:
log:
application: apache2
type: access
fields_under_root: true
So when I start the beat it ships apache logs to logstash.
After 5m of Apache inactivity on the access_log I get
File is inactive: /var/log/httpd/access_log. Closing because close_inactive of 5m0s reached
and Filebeat stops sending log updates to logstash after that.
New logs arriving in access_log are not shipped anymore.
So after 5 minutes of inactivity of Apache I am left with a Filebeat closing the file and not shipping logs thereafter.
If a file is updated after the harvester is closed, the file will be picked up again after
scan_frequency
has elapsed.
scan_frequency
If you require log lines to be sent in near real time do not use a very lowscan_frequency
but adjustclose_inactive
so the file handler stays open and constantly polls your files.
The default setting is 10s.
I understood that scan_frequency would be executed by default every 10s making Filebeat monitoring access_log new entries even after the file has been closed for inactivity.
This is actually not happening. After close_inactive time has passed new logs are never picked up again.
The other doubt I have is related to Filebeat file handing when a file gets rolled (gzipped).
Is there something I need to set in order to have Filebeat keep track of the new /var/log/httpd/access_log once the rolling operation is triggered?
It seems that when the file is gzipped I am also loosing Filebeat track of it.
Thanks