I would like to monitor the content a a log file generated by an application. Unfortunately, the name of the logfile is not static. Would be nice to have some regex or placeholder functionality in the sensor config menu! Additionally, it would be nice to be able to configure how PRTG should react in case if the logfile doesn't exist (ie the application has not been started) Do you see a practical workaround? Best regards, Tilman
Article Comments
Hi, Thanks for your help! The problem is that it should be a "realtime" monitoring of the logfile. I'm afraid I've to dig into some vb or powershell code... Best regards, Tilman
May, 2011 - Permalink
the application writes an rtf with a name such as 20110511_1520.rtf yes: it's really a rtf :-(
-> what I'll try to do next. write some vb or powershell code which looks for the oldest file (according to the filename). parse it, strip the rtf tags, return the line with timestamp if keywords match. Better solution are allways welcome!
May, 2011 - Permalink
hi, has there been a solution to this yet? I too have an application that starts a new log every night with a date in the filename. How can I get the content sensor to pick this file up every night?
Oct, 2012 - Permalink
Hello,
Same type of need here. Web server is writing daily logs with name format logfile-trace-YYYY-MM-DD with not extension.
Need to grep out "Error FILE_OPEN_FAILED" and report on the rate of occurence.
Feb, 2013 - Permalink
Use a batch file
If your log file is the result of a backup job, there is most likely an option to run a batch file after the completion of the job. In this batch file, copy the log file to a file with a fixed name.
and have the sensor check the "c:\temp\checkthis.txt" file.
This way the file will always exist and the sensor will not return an error.
More advanced solution
There is a small catch in the solution above. If the file contains text that should trigger the sensor and the sensor is already triggered by the previous version of the "c:\temp\checkthis.txt" file, notifications will not be send again.
To overcome this, we first need to make sure that the "c:\temp\checkthis.txt" file contains no text that triggers the sensor and force the sensor into an OK state by running the sensor.
The new batch file will now look something like:
Replace objectid with the ID of your sensor.
May, 2011 - Permalink