0
responses

Hi All

Could you confirm please that File_remove with wildcards AND File's created date condition works ?

I'm trying file_remove commands below :
The two first works properly => no problem with file_remove, "simple" or with wildcards
But not the last… using "now() - 18000", to remove file older than 5h never works, and no error in nxlog.log...looks like the line doesn't exist...?

<Schedule>
  Every 1 min
  Exec    file_remove('/var/log/MUP10/sac/APMUZS4WBS03-2016061300.log');
  Exec    file_remove('/var/log/MUP10/sac/APMUZS4WBS04-201606130*', now());
  Exec    file_remove('/var/log/MUP10/sac/APMUZS4WBS*.log', (now() - 18000));
</Schedule>

Thks

In Nxlog documentation :
~file_remove(string file, datetime older);
 description Remove the file ’file’ if its creation time is older than the value specified in ’older’. It is possible to specify a  wildcard in filenames (but not in the path). If you use backslash as the directory separator with wildcards, make sure  to escape this (e.g. ’C:\\test\\*.log’). This procedure will reopen the LogFile if this is removed. An error is logged if the operation fails.

AskedJune 14, 2016 - 11:55am

Answers (0)