fluent / fluent-plugin-mongo

MongoDB input and output plugin for Fluentd
https://docs.fluentd.org/output/mongo
173 stars 61 forks source link

fluentd stopped logging due to outdated position file #76

Open thkoch2001 opened 8 years ago

thkoch2001 commented 8 years ago

I just had a customer case where fluentd stopped sending mongodb logs. Removing the mongodb.pos file solved the issue.

I believe fluentd (or this plugin?) somehow did not notice that the mongodb log file was rotated. I do not know enough about fluentd or mongodb to suggest any mitigation strategy.

repeatedly commented 8 years ago

What does 'the mongodb log file was rotated' mean? It means do you re-create collection?

thkoch2001 commented 8 years ago

With log file rotation I mean what the logrotate unix tool does, although I do not know whether it was used here. On the customers instance I saw files like mongodb.log, mongodb.1.log, mongodb.2.log, mongodb.3.log.

So something (mongodb itself or logrotate) apparently, from time to time, renames the mongodb.log file to mongodb.1.log (and increment the names of the oter files) and makes mongodb log to a new mongodb.log file

Of course, fluentd needs to know that there is a new mongodb.log file so that it starts to read from the first line again.