Hi,
I am planning to use the File Content sensor to tail an application's log file.
Unfortunately, when the file gets to certain size, it moves the file into a folder and append a increasing number to the name.
After it will create a new file with the same original(without number) name.
My question is, because of the interval (minimum 30 seconds), will data get lost in cases such as:
1. During the 30 seconds wait time, log is rolled over (backed up, new file created with the same name). If there's a new line per second we could lose 20+ lines?
2. A time window however minuscule, during the instant PRTG polls and log is rolled at the same time.
Does the sensor has some sort of mechanism to deal with the above scenarios? It doesn't seem (because of the intervals) that PRTG does not have constant real time handle on the file?
Thanks!
Article Comments
I am sorry if I was not clear, the log file name that File Content sensor is pointing to will always have the same name.
Only, if I gets to a certain size it will be moved and a blank file of the same name will be placed exactly in the same location with the same name.
My question is: [Q] Can PRTG File Content sensor handle rolling logs? Will data be lost when a log is rolled over during the minimal 30s interval?
For example, I am tailing file "file.log" and the following are happening:
- file.log had 5 lines appended.
- PRTG probes for new lines.
- 30 seconds wait...
- 5 more lines appended.
- file.log renamed to file.log.1 and moved to ./logs/ folder.
- new ./file.log created.
- 5 more lines appended.
- PRTG probes for new lines.
Question Are the lines created in c1 lost?
Jul, 2016 - Permalink
And by the way, the previous post that says this topic "File Content sensor and rolling logs" solves the content monitoring of rolling logs is false. That topic covers monitoring a log file with changing filename, not the contents of said file. It will give you stats on when the file changed how old etc, and will not work when trying to monitor for specific content within the log file, like "Access Denied". Unless I misread.
May, 2017 - Permalink
Hi pir8adio,
That's true - you'll need to modify the script accordingly in order for it to check for content.
Kind regards,
Stephan Linke, Tech Support Team
May, 2017 - Permalink
Unfortunately, the sensor doesn't allow for wildcards within the file name. You may need to come up with your own custom sensor. This thread might be what you're looking for.
Jul, 2016 - Permalink