Parser file name

Started by Nikk, December 03, 2015, 01:03:13 PM

Previous topic - Next topic

Nikk

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

Victor Kirhenshtein

Hi,

yes, in log file name you can use format specifiers from 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

dersonik

Can I add something like C:\*.txt to monitoring few files with txt extension?

Victor Kirhenshtein

no, you can specify multiple <file> tags in parser, but wildcards are not allowed.

Best regards,
Victor

dersonik

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?

Victor Kirhenshtein

You can use 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