Using scripts to check logiles for errors

As far as I can see, the currently available scripts don’t include one that checks the logfiles for errors.

It should be pretty easy to setup, but before I invest time in figuring out exactly how to do, this maybe someone has some hints to share (or even a fully fledged script)? I’m mainly interested in PowerShell scripts but feel free to share other ones.

So I have a script with which I run duplicacy CLI once a day. The scripts redirects the standardoutput to a logfile, like this:

Start-Process -FilePath "c:\Program Files (x86)\Duplicacy\duplicacy.exe" -ArgumentList "$backupoptions" -RedirectStandardOutput "C:\duplicacy\logs\$tmplogfilename" -wait -NoNewWindow

And I was basically thinking to run a monitoring script (either as a post-command script, or as part of my existing script - what would be the pros and cons?) to search the logfile for certain terms such as “ERROR” and take action if it finds one of them.

Linux experts are thinking grep now. The equivalent for PowerShell is sls:

That’s how far I got so far. Feel free to dash ahead and tell me how to do it :grinning: