Favorite SharePoint PowerShell: Merge-SPLogFile

Ben Steginkpowershell, SharePoint 2013Leave a Comment

For those of you who have been around SharePoint PowerShell for a while, this cmdlet may be old new, for those of you that are new, you’re missing out and for others this may just be a good reminder about this cmdlet.

While it doesn’t do anything flashy, in my opinion, it is one of the most useful cmdlets in SharePoint for any SharePoint Admin, especially when you’re trying to fix an issue.

While it’s purpose is to actually pull (or merge) ULS log files from all the servers in your SharePoint farm into a single log file on the server you’re running the cmdlet on, it can be super useful even in a single server farm. One of my favorite parameters for the cmdlet is -correlation. This allows you to create a single log file, that only contains entries from the single correlation ID. This can be helpful if you have to email logs around a certain error to someone, or just don’t feel like searching/filtering your logs to a specific correlation ID.

A few other useful parameters are:
-Area: only show logs from one or more specific areas, i.e. “Excel Services” or “SharePoint Foundation”
-StartTime/-EndTime: set a time block to pull errors from
-Level: i.e. Information, Medium, Error, Critical, etc

As you can see, this can be very powerful both for merging logs files from all your servers in one farm as well as for just creating a small log file that has entries based on very specific criteria you specify.

To view the TechNet article documenting this cmdlet, you can click here.

Hope you find this useful and check back regularly foruture Favorite SharePoint PowerShell or better yet to get these and other blog post and news, by subscribing to my blog here or using the popup dialog in the lower right. And no, we will not give your email address to ANYONE and it’s super easy to unsubscribe if you change your mind later (we hope you wont):

Subscribe to my Blog