Monitor one or more debug.log files

Simple PowerShell script to read one or more debug.log files (see examples in script) and report back rows that contain specific values, e.g. ERROR, WARNING

You’ll need to update the $debuglogs value(s) to use the paths you have with your setup.

If you want to change what the script reports back, just update/add/remove the values on the ‘Get-Content’ line.

# Farmer Debug Monitor Script
# Reports ERROR, WARNINGS, OSError so you can see the wood from the trees.
# You can change ^these values^ if you want it to show you more 
# The debug logs we're shared over a network in this case, but you can change them
# to local folders if you wish.

$debuglogs = @('\\farmer\chialog$\debug.log','\\spare\sparelog$\debug.log')

while ($true)
{
ForEach ($logfile in $debuglogs)
    {
    write-host $logfile -BackgroundColor Yellow -ForegroundColor Black
    Get-Content -Path $logfile | Select-String -Pattern 'ERROR', 'WARNING', 'OSError' | Select-Object -Last 1
    }
}