NetXMS Support Forum

English Support => General Support => Topic started by: Nikk on December 03, 2015, 01:03:13 PM

Title: Parser file name
Post by: Nikk on December 03, 2015, 01:03:13 PM
Hi,

We have a case where we need to monitor a log file on one server, but the problem is the logfile name is created like "log yyyy-mm-dd.txt'' and are changing each day, is it possible to configure this timestamp in parsers file name?

Best regards,
Nikk
Title: Re: Parser file name
Post by: Victor Kirhenshtein on December 08, 2015, 02:13:30 PM
Hi,

yes, in log file name you can use format specifiers from strftime (http://www.cplusplus.com/reference/ctime/strftime). Parser will switch to new file when resulting name changes. For complicated cases you can also use `command` in file name - parser will execute external command and insert it's output.

Best regards,
Victor
Title: Re: Parser file name
Post by: dersonik on October 18, 2016, 07:04:58 PM
Can I add something like C:\*.txt to monitoring few files with txt extension?
Title: Re: Parser file name
Post by: Victor Kirhenshtein on October 20, 2016, 09:19:17 AM
no, you can specify multiple <file> tags in parser, but wildcards are not allowed.

Best regards,
Victor
Title: Re: Parser file name
Post by: dersonik on October 20, 2016, 10:15:44 AM
Ok so if for example backup program like robocopy creating log file like dd-mm-yy.txt how to monitoring this file then? some backups program generating files with hours in name. Is very hard to predict when backups will finish so i don't know how looks like the log file name? any help?
Title: Re: Parser file name
Post by: Victor Kirhenshtein on October 20, 2016, 10:40:30 AM
You can use strftime (http://www.cplusplus.com/reference/ctime/strftime/) patterns in file name. For example, to match dd-mm-yy.txt you can use %d-%m-%y.txt as file name. If hour is included, for example yymmddhh.txt - %y%m%d%H.txt. As time changes system will check different file names. If you need something even more complicated you can call external script to determine part of file name, like this: log-`script.cmd`.txt - it will call script.cmd and use it's output as part of file name.

Best regards,
Victor