Tail plugin stops reading on windows due to the lock of the file


I noticed that once in couple of days, I get this error in the log:

After that, tail plugin stops picking up changes from the file.

I tried inotify and poll methods, same thing.

How to resolve it?

thank you in advance.

The error essentially means some other process has locked that file and as a result, telegraf is not able to read it. There is no telegraf setting to prevent this, as this is the result of some external process coming in and locking the file, preventing telegraf from reading.

You should see if you have any virus scanning or backup tooling or some other items that is writing to that file and also locking it while running.

1 Like

Thank you for you reply,

Unfortunately, this log file is being written by another product and this is a production server that is not managed by me. So there is very little can be done, to change the way the file is accessed.

I thought that my be the tail plugin, could ignore this error when it happens and then try again in the next iteration. If the file is locked for X seconds/minutes , it’s not a reason to stop reading from it until next restart.

@AlexL can you please open an issue on Telegraf!? I think we should not stop tailing that file but simply skip the change or retry or something…

1 Like


Yes, I agree that it should not stop reading. I saw there is already an issue opened there since 2019, I replied to it to bump it … Hope it will be fixed

Logparser/tail input on Windows stops sendings logs due to file being locked · Issue #6539 · influxdata/telegraf (github.com)