Tail a Log File using Windows PowerShell

In Windows, you can use the PowerShell to do the tail functionality. So, to execute this, following below commands,

• To view the bottom X number of lines from a log file.

Get-Content YOUR_LOG_FILE –Tail 30

• To get tail end of a log in real time.

Get-Content YOUR_LOG_FILE –Wait

• To filter the log using keyword.

Get-Content YOUR_LOG_FILE -wait | where { $_ -match “CRITICAL” }

You May Also Like

1 Comment

  1. Thx for this hint but if i want to watch e.g. the security log i get an ReadError because the log is used by annother application even when i tried it as admin. Any ideas to have a solution like “tail -f $LOGFILE”?

    Kind regards, MuckiSG

Leave a Reply?