Output udpfile rotate_to wrong filename

View thread

hate

Hi,

I am using NXLog with the Example 108. “File Rotation Based on Size” from the NXLog Community Edition Reference Manual.

In rare cases i have the problem that rotate_to uses the wrong filename and overwrite some other logfile. In the example below “logid.log” to “Mod-002”.  See nxlog.log

Version:  nxlog-ce-3.1.2319

nxlog.log

Zeile 3644025: 2023-03-14 10:28:02 INFO om_file successfully rotated file 'C:\Program Files\nxlog\data\10.87.243.24\logid.log' to 'C:\Program Files\nxlog\data\10.87.243.24\Mod-002.20230314102802.log'

nxlog.conf

## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html

Please set the ROOT to the folder your nxlog was installed into,

otherwise it will not start.

define ROOT C:\Program Files\nxlog #define ROOT C:\Program Files (x86)\nxlog

define CERTDIR %ROOT%\cert define CONFDIR %ROOT%\conf define LOGDIR %ROOT%\data

Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data LogFile %ROOT%\data\nxlog.log

<Extension exec> Module xm_exec </Extension>

<Extension syslog> Module xm_syslog </Extension>

<Extension fileop> Module xm_fileop </Extension>

<Input udp> Module im_udp Host 10.87.243.20 Port 514 Exec parse_syslog(); Exec dir_make('%LOGDIR%' + $Hostname); </Input>

<Output udpfile> Module om_file CreateDir TRUE File '%LOGDIR%' + $Hostname + '' + $SourceName + '.log' Exec if udpfile->file_size() > 5M {
$newfile = '%LOGDIR%' + $Hostname + '' + $SourceName + '.' + strftime(now(), "%Y%m%d%H%M%S") + '.log';
udpfile->rotate_to($newfile);
exec_async('%CONFDIR%\bzip2.exe', $newfile);
} </Output>

<Route udp> Path udp => udpfile </Route>

Any ideas what's going wrong here?

Thanks