That is not a logstash or Elastic problem, when your files are rotated your system seems to change the permissions.
Be aware that ingesting rotated log files will result in duplicate logs.
You should just injest app.log as log are created, if you want an history ( eg ingesting already rotated logs while setting up app.log you should do it in a separate config )
@grumo35 thank you for helping.
app.log not being read by logstash
With below configuration app.log sometimes the inode changes are not updated. when I restart logstash manually new content is updated in sincedb_app file (new inode changes). app.log is pushed by logstash.
I use tail mode app.log is actively written. Please help.
this will read all the file app.log and app.log.1, app.log.2 .....
file lock will also not happen when reading the archive file as I m using the read mode.
This second file input is not needed in most of situations and may lead to duplication.
Logstash can handle file rotation, your issue is that when the file is rotate it seems that the permissions are being changed, so logstash can not read anymore from the previous file, now rotated to .1.
This needs to be fixed outside logstash, if it is not possible you may need to the path to app.log.1 in your file input, but do not change from tail mode to read mode as this can lead to duplication.
@leandrojmp I see one observation here when I try to open app.log.1 file. If I try to stop logstash and open the file. I can do it. That's the reason I m saying logstash locks the file.
Please advise.
app.log rename to app.log.1. logstash should still able to tail app.log not sure why this is not happening.
If Logstash is reading app.log and this is rotated to app.log.1, logstash will finishes processing the rotated file, app.log.1 and then start reading app.log.
I'm not sure exactly how this file is being rotated, if the permissions changes during rotation, then logstash will not work as expected.
From the log you shared it seems that the permissions may be changed and logstash cannot finish reading the file after it is rotated.
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.