Hey,
i'm experiencing an rotation issue on my windows machines.
machine: Windows 2012 R2
version: 1.3.1
configurations:
global config: https://nopaste.me/view/9ef7645a
prospector config: https://nopaste.me/view/cf174611
I detected that files are read twice, so i decided to add debugging statements to the following line: https://github.com/elastic/beats/blob/v1.3.1/filebeat/crawler/registrar.go#L205
for oldFilePath, oldState := range r.getStateCopy() {
+ logp.Info("CHECK STATE: new:%s old:%s", newFilePath, oldFilePath)
+ logp.Info("CHECK STATE: new:%s %s %s", newState.IdxHi, newState.IdxLo, newState.Vol)
+ logp.Info("CHECK STATE: old:%s %s %s", oldState.FileStateOS.IdxHi, oldState.FileStateOS.IdxLo, oldState.FileStateOS.Vol)
The result is the following: https://nopaste.me/view/3a013b38 . The application3.log is renamed to C:/server/wildfly/standalone/log/application3.log.2016-09-27 and a new application3.log is created.
On the LOG you can see that the call "Prospector.scan -> Registrar.fetchState -> Registrar.getPreviousFile" will be executed twice (for the new and renamed file).
First the new file is checked against r.getStateCopy() and afterwards the renamed file too.
Because Prospector.scan and therefore (p.checkNewFile / p.checkExistingFile) will start an harvester and do an registrar state update ("p.registrar.Persist <- h.GetState()"),
the state of the old file is overridden and for the second run (renamed run), there is no state available to check against. Therefore the renamed file will be read twice.
Workaround seems to be setting the glob of the rotated files first and then the glob of the original file. In addition this problem occours only sometimes if the state-update is faster than the Prospector.scan. Any ideas, since this behavior is undocumented and annoying?
Regards
Hajo