What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Monitoring log-files

Votes:

0

Your Vote:

Up

Down

Hello. I'd like to imply about the PRTG 13's possibilities of monitoring the applications' log-files. I suppose it can be done with the File Content sensor, right? However if the sensor finds what it searches for and goes to a warning state, it keeps this state 'til the log-file is re-written. Is there a way to search only the end of a log-file?

file file-content file-monitoring log

Created on Sep 19, 2013 10:19:17 AM by  darina (0) 1



6 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

thank you very much for your KB-Post. I'm very much afraid the File Content Sensor is not able to "solve" this task. You could achieve this though with a self - written Custom Exe/Script Sensor.

Best regards.

Created on Sep 19, 2013 3:24:13 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Darina,

I use the File Content Sensor with a custom script to perform what you are referring to. Example powershell below to retrieve the latest log file, parse out the last 25 lines to a file, point the File Content Sensor to that file to only see the end of the log file.

Configuration Guide:

  1. Open both elevated x86 and x64 Powershell, set-executionpolicy Unrestricted
  2. Add service account user to ACL for c:\scripts, permit read/write
  3. Configure task scheduler to run the script every 10 minutes, run as service account
  4. Configure the sensor to check this file and roll-up to the sensor ID ever 10 minutes
  5. Change select - Last from 25 to however many lines you want to parse at the end of the log file
$files = Get-ChildItem \\servername\logpath\logfile* | Sort-Object LastWriteTime -descending
$fileName = $files[0].FullName

Get-Content $fileName | select -Last 25 > c:\SearchStatusMonitor.log

Created on Sep 20, 2013 5:56:05 AM by  Randolfini (270) 2 1

Last change on Sep 20, 2013 8:00:50 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Randolfini,

Thank you, I'll try to configure it the way you suggested. Just one question - what do you mean by "roll-up to the sensor ID ever 10 minutes"? I'm afraid I'm not quite getting this part, could you please explain it?

Created on Sep 25, 2013 7:15:55 AM by  darina (0) 1



Votes:

0

Your Vote:

Up

Down

Darina,

Sure, sorry I didn't explain #4 very well. I've found that if I use the built-in sensor for file content it has issues reading the file (cannot recall all the details, but it is a permissions problem). So instead I use the stand alone sensor, LogFileReader.exe, which should exist in C:\Program Files (x86)\PRTG Network Monitor\Sensor System\, or just Program Files if you are not running the x64 version.

Add a custom sensor, EXE/Script, find LogFileReader.exe in the list. In the parameters field I use -f=C:\Scripts\SearchStatusMonitor.log -s="system error code" -id=32563 -l

The parameters are
-f=file
-s=searchstring
-id=sensorID *This is where you put the sensorID of the sensor you created and what I meant by "roll-up to the sensor ID"
[u-username]
[-p=password|passwordhash]
[-r=RegEx]
[-l] Optional, returns the linenumber of the found string
[-t] Optional, returns the found textline as output message

Created on Sep 26, 2013 12:55:30 PM by  Randolfini (270) 2 1

Last change on Sep 26, 2013 1:05:53 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Randolfini,

Got it! Thank you very much again for your suggestion and help.

Created on Sep 27, 2013 4:39:44 AM by  darina (0) 1



Votes:

0

Your Vote:

Up

Down

Something to add, the script is looking for a file that confirms to your name and then it looks for the most recent one. This is useful for log files that roll daily.

Created on Sep 27, 2013 2:10:25 PM by  Randolfini (270) 2 1



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.