Get log details using Merge-SPLogFile CMDlet

As you encounter any error/issue with your SharePoint estate, you want to know root cause of the error. You might have the correlation ID of the error or some other basic information like start time, end time etc.

You can open ULS Viewer but  it is very tedious to go through the logs and find out the cause of any issue.

With PowerShell, you can reduce the effort by using the Merge-SPLogFile CMDlet. The script given below merges the log files for specific correlation ID and start time.

Add-PSSnapin Microsoft.SharePoint.PowerShell
    
Merge-SPLogFile -Path "<path where you want to store merged log>" -Correlation "<Correlation ID>" -Overwrite -StartTime '02/01/2014 11:00:00'




There are many other parameters configurable for this CMDlet. Using Start time and end time parameters you can increase the performance.

More examples are provided at :
http://technet.microsoft.com/en-us/library/ff607721(v=office.14).aspx


 

1 comment: