I'm receiving complaints about NxLog locking files it is monitoring. This is the nxlog.conf file:
Code: Select all
define ROOT C:\Program Files (x86)\nxlog
define CERT %ROOT%\cert
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
# Include fileop while debugging, also enable in the output module below
#<Extension fileop>
# Module xm_fileop
#</Extension>
<Extension json>
Module xm_json
</Extension>
<Extension syslog>
Module xm_syslog
</Extension>
<Extension multi>
Module xm_multiline
HeaderLine /ERROR|DEBUG|WARN|INFO|TRACE/
</Extension>
<Input internal>
Module im_internal
</Input>
# Watch your own files
<Input file1>
Module im_file
File '%ROOT%\data\nxlog.log'
SavePos TRUE
</Input>
<Input filetomcatjob>
Module im_file
File 'M:\Software\Apache Software Foundation\Tomcat 7.0\logs\job.log'
SavePos TRUE
Exec $Message = $raw_event;
InputType multi
</Input>
<Input filetomcatportal>
Module im_file
File 'M:\Software\Apache Software Foundation\Tomcat 7.0\logs\portal.log'
SavePos TRUE
Exec $Message = $raw_event;
InputType multi
</Input>
# Windows Event Log
<Input eventlog>
# Uncomment im_msvistalog for Windows Vista/2008 and later
Module im_msvistalog
# Uncomment im_mseventlog for Windows XP/2000/2003
# Module im_mseventlog
</Input>
<Output out>
Module om_tcp
Host ipnls
Port 3515
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
# Uncomment for debug output
# Exec file_write('%ROOT%\data\nxlog_output.log', $raw_event + "\n");
</Output>
<Output outfiletomcatjob>
Module om_tcp
Host nlsip
Port 5550
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
# Uncomment for debug output
# Exec file_write('%ROOT%\data\nxlog_output.log', $raw_event + "\n");
</Output>
<Output outfiletomcatportal>
Module om_tcp
Host nlsip
Port 5551
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
# Uncomment for debug output
# Exec file_write('%ROOT%\data\nxlog_output.log', $raw_event + "\n");
</Output>
<Route 1>
Path internal, file1, eventlog => out
</Route>
<Route 2>
Path filetomcatjob => outfiletomcatjob
</Route>
<Route 2>
Path filetomcatportal => outfiletomcatportal
</Route>But as apparently NxLog locks the job.log file, an error is received while trying to rename the file job.log => "The action can't be completed because the file is open in nxlog."
This causes our application to stop logging it's job info... As this is a highly critical application, I have commented out the file inputs, outputs and routes for now.
Any help preventing the above issue from happening is welcome.
Edit:
Found this https://www.mail-archive.com/nxlog-ce-u ... 00261.html Seems like there are two solutions:
1) Monitor the renamed file
How would I have to rename "File 'M:\Software\Apache Software Foundation\Tomcat 7.0\logs\job.log'" so it always take the day before the current day?
Code: Select all
<Input filetomcatjob>
Module im_file
File 'M:\Software\Apache Software Foundation\Tomcat 7.0\logs\job.log'
SavePos TRUE
Exec $Message = $raw_event;
InputType multi
</Input>How could I schedule this import with NxLog? I can't find any immediate example of how to do such a thing.
Grtz
Willem