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 rsync Command to Sync Files and Directories on Linux
The rsync command is one of the most powerful tools in the Linux toolkit for syncing files and directories. Whether...
How to Use the CMDKEY Command to Manage Stored Credentials on Windows
The cmdkey command is a Windows utility that lets you create, delete, and manage stored credentials for network authentication. This is particularly useful…
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.
Average Rating