What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Monitor Multiple Log Entries

Votes:

0

How can I search for multiple log entries in one log file since the File Content Sensor can only search for one string?

custom filecontent prtg script string

Created on Mar 8, 2022 9:09:03 AM by  Felix Wiesneth [Paessler Support]

Last change on Mar 8, 2022 9:27:24 AM by  Timo Dambach [Paessler Support]



1 Reply

Accepted Answer

Votes:

1

This can be done with a custom script and the EXE/Script Advanced sensor. Following script needs to be saved as .ps1 file and stored in \Custom Sensors\EXEXML

param([string]$Path, [string[]]$Strings)

Write-Output "<prtg>"

foreach ($String in $Strings) {

$NumberString = Select-String -Path $Path -Pattern $String -AllMatches

$ValueString = $NumberString.Matches.Count

Write-Output "<result>
           <channel>$String</channel>
           <value>$valueString</value>
           </result>"
}

Write-Output "</prtg>"


Afterwards you can add the sensor and add following in field Parameters:

-Path "C:\YourLocation\Logfile.txt" -Strings YourString1,YourString2,YourString3

Important: Please note that officially we do not support customization of any kind. If it's not working as expected, or if it stops working with newer PRTG versions, we won't be able to assist you further. Please also refer to the following article which explains why we can't officially offer any customization help for PRTG: https://kb.paessler.com/en/topic/78334

Created on Mar 8, 2022 9:25:39 AM by  Felix Wiesneth [Paessler Support]

Last change on Mar 8, 2022 10:27:03 AM by  Felix Wiesneth [Paessler Support]




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.