Delen via


Pretty darned useful - "Merge-SPLogFile" cmdlet

My favorite ULS logging PowerShell command is described here:  https://technet.microsoft.com/en-us/library/ff607721.aspx.  The Merge-SPLOgFile cmdlet pulls trace log entries from all farm computers into a single log file on the local computer and it works in Project Server 2010 and 2013, too. 

I can hand this link to customers and they can run the Merge-SPLogFile command from PowerShell.  The result is a single output file they can easily upload for me to review.  The real benefit to this command, as someone who does troubleshooting remotely, is that I get all ULS entries from all the servers combined.  Pretty neat.

Merge-SPLogFile -Path "c:\mergelog\log.txt" -Overwrite -level High -StartTime "03/25/2014 12:00" -EndTime "03/25/2014 12:59"

Edit: You can also use this command to pull just the entries related to a particular correlation ID, which is very useful, because the command will pull only those ULS log entries related to the error you are seeing.  Just replace the Correlation below with your own from whatever error message you see.

Merge-SPLogFile -Path C:\mergelog\log.txt -Correlation 29b5c483-c48b-4ef2-b4b3-f5e29f635d31

This creates a much smaller output file to search through and you know that ALL of the entries in the log file are related to the particular problem.

Comments

  • Anonymous
    January 01, 2003
    Thanks for commenting, BlueSky2010! I just tested to confirm and the command will work with or without quotes around the correlation ID.
  • Anonymous
    January 01, 2003
    Thanks for putting this together Brooks! I wonder whether or not the 2nd example needs quotation mark with the correlation ID.

    For example: Merge-SPLogFile -Path C:mergeloglog.txt -Correlation "29b5c483-c48b-4ef2-b4b3-f5e29f635d31"
  • Anonymous
    November 21, 2016
    Thanks for this post very helpful
    • Anonymous
      November 22, 2016
      Thanks for reading, Rob!