4
answers
closed

Hi,

I'm attempting to do daily log rotation across a bunch of logs. Some are not working and in nxlog's own log it reports "The process cannot access the file because it is being used by another process". It's always the same few log files and we have other, far busier logs (which I might expect to be locked by an active write at the time of rotation) which are consistently working just fine. Some of them which are failing are using the file_cycle function, others using the rotate_to function. I've tried rebooting the whole server, just to be sure nothing else is locking the files.

Any ideas?

Thanks

James

Support ticket opened onFebruary 9, 2017 - 2:26pm

Comments (4)

  • b0ti's picture

    State: closed -> active

    Both rotate_to() and file_cycle() rely on the same OS level function calls to rename or move the file so I doubt that the cause is internal to nxlog. 

    I assume that the file that fails is held open by an app that uses exclusive locking. There is not much nxlog can do if the OS refuses to rename the file. What you could do is to stop the "owner" process before attempting to rotate but this is not always feasible.

    To troubleshoot such issues I suggest using process explorer to check what's going on with the file. Here is a similar issue: https://nxlog.co/disappearing-windows-dns-debug-log

    You should also check whether the rotation moves the files across physical drives or it's simply renamed in-place. In the former case this error is more likely to happen.

    February 9, 2017 - 3:09pm
  • James's picture

    Thanks for the quick response. This issue is within an output (om_file) rather than input. It's only nxlog itself writing to the log and nothing else reads or writes to it. Rotation is set to rename within the same drive and folder.

    February 10, 2017 - 12:03pm
  • b0ti's picture

    > It's only nxlog itself writing to the log and nothing else reads or writes to it.

    This doesn't sound right if you look at the error message: The process cannot access the file because it is being used by another process

    It refers to the fact that there is indeed another process involved.

     

    It would be best if you could provide a config file and the steps needed to reproduce the issue on a clean windows system.

     

    February 10, 2017 - 7:15pm
  • b0ti's picture

    State: active -> closed

    I'll close this as there was no follow up. Please reopen if you are still having issues.

    June 9, 2017 - 1:57pm