You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just upgraded my ELK cluster from 2.x version on Debian 8 to 6.x version on Debian 9.
Some basic information about my setup.
I have rsyslog that receives data and write them into the files.
Logstash with input plugin file reads files using wildcard path and after some processing it sends them to Elasticsearch nodes.
Files are rotated by logrotate with nocopy/nocopytruncate options.
So inodes of file is kept, files are only renamed (from test.log.1 -> test.log.2, test.log -> test.log.1, etc.) and new file is created (test.log).
On Debian 8 with ELK v2.x everything worked just fine.
After upgrading to Debian 9 with ELK v6.x I encountered a problems with duplicately processed files after logrotation takes place. I was trying to replicate it to have some debug informations. The issue doesn't occur everytime in my testing environment.
In this particular case I was able to replicate the issue with last file beeing processed duplicately by input plugin file.
For example, if I have:
test.log
test.log.1
test.log.2
Then during logrotation test.log.2 is renamed to test.log.3, test.log.1 is renamed to test.log.2, test.log is renamed to test.log.1 and new file test.log is created.
Logstash watches all the files and trackes them in sincedb file.
Sometimes after logrotation, logstash picks the last file, test.log.3 and reads it again.
In tested case that is stated below the problem was with the file test.log.17 that was processed again after logrotation as test.log.18.
ls -li: 14 -rw-r----- 1 root logstash 122278 Dec 3 15:45 test.log.17
files from /var/ls/remotelogs/test/ that are opened by logstash process: lr-x------ 1 logstash logstash 64 Dec 3 17:00 96 -> /var/ls/remotelogs/test/test.log
Just after logrotation, see the sincedb file (the file with inode 14 is still there, but with old filename test.log.17. test.log.17 is there twice, as test.log.16 that was renamed to test.log.17 with inode number 12 and test.log.17 that has inode number 14, but now is named test.log.18 - this change stays unnoticed by logstash input filter):
Is this fixed in the latest release? Because i currently face a similarly problem. Here is my environment. On server A i use filebeat with file output and rotation. Then i transfer these files to server B (logstash server) with sftp every 10 minutes. The inodes of the transferred files remain the same. Now the problem is that every time the new files were transferred to logstash server and logstash read them, it seems that it always reads all files again and put them into elasticsearch. Lets say i have 1000 entries in filebeat, filebeat.1, filebeat.2, .... Then on first read i have 1000 entries in elasticsearch. On second read it's 1800, 2100, 2600, ... even though the number of entries in the logfiles only increase by 10 or 20.
Hi,
I just upgraded my ELK cluster from 2.x version on Debian 8 to 6.x version on Debian 9.
Some basic information about my setup.
I have rsyslog that receives data and write them into the files.
Logstash with input plugin file reads files using wildcard path and after some processing it sends them to Elasticsearch nodes.
Files are rotated by logrotate with nocopy/nocopytruncate options.
So inodes of file is kept, files are only renamed (from test.log.1 -> test.log.2, test.log -> test.log.1, etc.) and new file is created (test.log).
On Debian 8 with ELK v2.x everything worked just fine.
After upgrading to Debian 9 with ELK v6.x I encountered a problems with duplicately processed files after logrotation takes place. I was trying to replicate it to have some debug informations. The issue doesn't occur everytime in my testing environment.
In this particular case I was able to replicate the issue with last file beeing processed duplicately by input plugin file.
For example, if I have:
test.log
test.log.1
test.log.2
Then during logrotation test.log.2 is renamed to test.log.3, test.log.1 is renamed to test.log.2, test.log is renamed to test.log.1 and new file test.log is created.
Logstash watches all the files and trackes them in sincedb file.
Sometimes after logrotation, logstash picks the last file, test.log.3 and reads it again.
In tested case that is stated below the problem was with the file test.log.17 that was processed again after logrotation as test.log.18.
Logrotate config:
Logstash input configuration (ignore_older and sincedb_clean_after are kept in default settings what should be OK):
Sincedb file before final logratation (problematic file on the top, with inode number 14, named test.log.17):
ls -li:
14 -rw-r----- 1 root logstash 122278 Dec 3 15:45 test.log.17
files from /var/ls/remotelogs/test/ that are opened by logstash process:
lr-x------ 1 logstash logstash 64 Dec 3 17:00 96 -> /var/ls/remotelogs/test/test.log
Just after logrotation, see the sincedb file (the file with inode 14 is still there, but with old filename test.log.17. test.log.17 is there twice, as test.log.16 that was renamed to test.log.17 with inode number 12 and test.log.17 that has inode number 14, but now is named test.log.18 - this change stays unnoticed by logstash input filter):
ls-li shows that file is really renamed and logrotation was as expected (without inode change):
After few seconds, filename is updated in sincedb file is updated (notice that offset counter was also updated as the file was processed again):
Process is now reading three files (test.log and test.log.1 is expected, but also test.log.18 is beeing read):
Stat on test.log.18 file:
Basic version info of current setup:
The text was updated successfully, but these errors were encountered: