Newbie trying to rotate log files

View thread

mdemougin

Hello all,

I'm trying out NXLog to do some basic log file rotation. I'm just looking for it to rotate a specifed log file when it gets past 100K. For a PoC I've set up my nxlog.conf as follows, but no logs are ever rotated nor do any of the log_info calls ever get into the nxlog.log. Can someone help me with what I'm trying to accomplish? Thanks.

define TESTLOG 'C:\Logs\testlog.log' <Extension fileop> Module xm_fileop </Extension>

<Input logrotatein> Module im_file File "%TESTLOG%" </Input>

<Output logrotateout> Module om_file File %TESTLOG%

&lt;Schedule&gt;
    Every 30 seconds
	log_info('I am doing something');
    Exec if (file_size('%TESTLOG%') &gt;= 100K) 
	{
		log_info('I am rotating');
		file_cycle('%TESTLOG%',500);
		logrotate-&gt;reopen();
	}
&lt;/Schedule&gt;

</Output>

<Route 1> Path logrotatein => logrotateout </Route>