Ask questions. Get answers. Find technical product solutions from passionate experts in the NXLog community.

Log Rotation Help
Hi, I'm currently outputting my desired log into a specific folder. I'm attempting to rotate the output file by size. Is there any limitations if i'm not under a enterprise license? Anyway this is the error i'm getting: ERROR failed to determine file size of 'APPLOGFILE': The system cannot find the file specified. This is my config Panic Soft #NoFreeOnExit TRUE define ROOT C:\Program Files (x86)\nxlog define CERTDIR %ROOT%\cert define CONFDIR %ROOT%\conf define LOGDIR %ROOT%\data define LOGFILE %LOGDIR%\nxlog.log LogFile %LOGFILE% Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data define APPLOGFILE'/Program Files/Nxlog/Parsed_syslog/my_parsed.log' Module xm_fileop Module xm_exec Module xm_syslog Module xm_charconv AutodetectCharsets utf-8, euc-jp, utf-16, utf-32, iso8859-2 Module xm_json Module xm_multiline HeaderLine /[\d\t .:]+ [1A-Za-z-]+ [MXZa-z-]+ [\d.\/-]+ [\d:]+ CEST \|/ #5140 udp listenner Module im_udp Host 0.0.0.0 Port 5140 #writes input to a file Module om_file File '/Nxlog/Raw_syslog/'+ strftime(now(),'_%Y_%m_%d') + '_my_raw.log' Module im_file SavePos True ReadFromLast True File '/Nxlog/Raw_syslog/'+ strftime(now(),'_%Y_%m_%d') + '_my_raw.log' InputType multiline_header $type = 'my Log'; $SourceModuleName = 'NxLog'; $SourceModuleType = 'my Log Source'; $Message = $raw_event; if not (($raw_event =~ /TEST REGEX/)) drop(); Module pm_norepeat CheckFields Hostname, Message, SourceName #output of the transformation Module om_file File 'D:/Program Files/Nxlog/Parsed_syslog/my_parsed.log' Exec $raw_event = to_json(); Every 30 sec if(file_size('APPLOGFILE') >= 100M) { file_cycle('APPLOGFILE',500); my_json_out->reopen(); } #1st route Path udp_my_listenner => my_raw_to_file #2nd route Path raw_udp_file => norepeat => my_json_out * What am i doing wrong? can anyone suggest a better config? This is my first time configuring log rotation via nxlog. * What i would like to achieve as and output is that every x seconds if the file exceeds 100MB it's rotated and a new file is created.

jd01 created
Replies: 5
View post »
last updated
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%'

&lt;Schedule&gt;
    Every   10 sec
    Exec    if (file_size('%FWLOG%') &gt;= 1K)  \
            { \
                file_cycle('%FWLOG%',10); \
                OUT-&gt;reopen(); \
            }
&lt;/Schedule&gt;

</Output>

<Route 1> Path FWLOG => OUT </Route>


EL_GA created
Replies: 2
View post »
last updated