how can i setup filebeat so after each filebeat service restart it start reading the files from last line and stop it from reading the file from beginning.
Filebeat keeps the state of each file and frequently flushes the state to disk in the registry file. The state is used to remember the last offset a harvester was reading from and to ensure all log lines are sent.
hi, thanks for the reply. what i want is the filebeat start reading from last line of a log file when it stars. assume i have a file that have the logs for the past 5 years and still being updated. i want when i start logstash it starts reading new logs (since filebeat start) and not start from beginning of the file and reading logs from 5 years ago.
The best approach is rotate the file and create a new one for new logs. Set ignore_older to not ingest previous file logs. Though if you can archive or move to different path, then you don't need to set ignore_older.
You can give a try by setting exclude_lines. I haven't try but you can add regex on timestamp in your logs (specifically date or year) but you need to handle properly.
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.