xm_fileop - The process cannot access the file because it is being used by another process
Hello,
I'm trying to use the log rotation functionality of nxlog but when nxlog tries to rotate is get the follow error message:
Error failed to rename file from C:\Users\me\Desktop\pfirewall.log to C:\Users\me\Desktop\pfirewall.log.1: The process cannot access the file because it is being used by another process.
Is there anyway to get around this?
Here is my nxlog.conf
define ROOT C:\Program Files (x86)\nxlog
Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data LogFile %ROOT%\data\nxlog.log
define FWLOG C:\Users\me\Desktop\pfirewall.log
<Extension _syslog> Module xm_syslog </Extension>
<Extension fileop> Module xm_fileop </Extension>
<Input FWLOG> Module im_file File '%FWLOG%' InputType LineBased SavePos TRUE </Input>
<Output OUT> Module om_file File '%FWLOG%'
<Schedule>
Every 10 sec
Exec if (file_size('%FWLOG%') >= 1K) \
{ \
file_cycle('%FWLOG%',10); \
OUT->reopen(); \
}
</Schedule>
</Output>
<Route 1> Path FWLOG => OUT </Route>
This is most likely caused by the source application (Windows Firewall) keeping the file open with an exclusive lock.