I am using Filebeat 6.3.0 to forward log files from a Rails application to Logstash. The files originate from a server that I cannot configure to use Filebeat, hence they are being transferred to the Filebeat/Logstash host via an rscript call.
The logfiles rotate on the server, so every once in a while, the existing log is rotated out to a .log.0 file.
I have read this topic where it is suggested that if the files are being appended to, I should be fine. But as far as I can see, rsync only transmits the delta anyway (as --no-whole-file is the default for network transmissions).
Are my settings correct?
(The reason I am asking is that I am seeing input spikes in my timestamps, and other periods where there are no data being ingested for several hours, and this actually cannot be the case, as my data is coming in more or less constantly.)
i also use rsync to transfer logs from an old server and had similar problems
what works for me is to explicitly specify the logs which should be synced and only sync so that only one type of log is synced with one run and pay attantion to the rollover number they must be (for me) alphabetically continously (no 10 between 1 and 2)
rsync -az --delete-after <path to the log directory>/*.log.[1-9] root@<server to sync to>:/root/copied_logs/<hostname>/<subdirs>/
P.S. i don't sync the real time log only the historical logs, but for me this creates only a gap of one hour
In fact, using --append, even some old logs stopped being written to on the target server, hours ago. Only when I leave out --append, all the data is correctly transferred.
It seems that the only option is to rotate frequently and only sync full files (i.e. the ones ending with a number).
on my setup there was also the problem that newly created logs from rsync got the inode from the log that was deleted and so filebeat has continued to read from the last known position in this log. See if that is also a problem for you.
i think i had a discussion with a elastic teammember on a github issue about using rsync and that should no longer happen but i'm not sure it was solved
I think that my original solution works fine (i.e., not using --append), as long as Filebeat is able to process an entire log file before it gets rotated over.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.