Monitor a Log File While It Is Being Written To Using The PowerShell Tail Parameter
Share
Recently, I had a client with a process that was out of control. The logs kept getting too large, too quickly and I wasn’t able to read it with Notepad++. I know that there are many other large text file readers, but I wanted to be able to monitor log as it grew. I was on a Windows Server so this was a perfect opportunity to use the PowerShell Get-Content -Tail & -Wait parameters.
Get-Content .\example.log -Tail 5 –Wait
The -Tail 5
portion does exactly what it sounds like it does… grabs the last 5 lines of text.
The -Wait
parameter displays the next lines as they are added to the file.
This came in really handy for me and I hope it does for you too.
Author
Stewart Schatz
More Stories
How to Use the XCOPY Command in Windows
Did you know that all versions of Windows have a limitation of 260 characters that can be in the path...
Quick Tip: Determine Active Directory Account Status From The Windows Commandline
Use the following command to Determine Active Directory Account Status from the Windows Commandline without Powershell or any special software....
Where Is Java Installed?
Below are a few commands that can be run to determine where Java is installed on each Operating System: Windows:...
Windows God Mode… What!?!
Windows God Mode is a hidden feature in the Windows operating system that allows users to access all of the system’s control panel options and settings in a single place.
A Better SMTP Test
Several years ago, I posted about an SMTP Test that I was using. Well, lately, I've needed something with a...
How To Kill All Processes With The Same Name On Windows
The taskkill command can be used many different ways to end or kill running processes on Windows Server 2012 and...
Average Rating