1

I am working with a product, that every time its windows service is restarted, it creates a new folder with date and timestamp, and starts logging into files in this folder.

I am looking for a tail program, that will allow me to tail the "MyLog.log" file across these new folders.

Like this pseudo pattern: c:\log*\mylog.log

A match for the last created file matching that pattern would be a good match.

Anyone know such a tail?

1
0

You could do this with PowerShell:

$LatestLogFile = Get-ChildItem c:\log*\mylog.log | Sort-Object lastwritetime -Descending | Select-Object -First 1

Get-Content $LatestLogFile -Wait

This should ensure that it always grabs the latest written log file if more than one are found.

It's worth noting though that this won't find a newer log file that's generated until the script is rerun.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.