In this post we will discuss about Merge-SPLogFile in SharePoint 2010/2013. This command works for both SharePoint 2013 and SharePoint 2010.
Also you can check out:
Merge-SPLogFile cmdlet combines trace log entries from all farm computers into a single log file on the local computer. You can run this command from PowerShell.
This will be very much helpful if you are working in multiserver environment. As SharePoint maintains log entries in each server, by using this command you can pull them in a single file.
You can filter based on various criterial like StartTime and EndTime, Process, Area, Category, EventID and Message etc.
Below is the full syntax according to Microsoft.
Merge-SPLogFile -Path <String> [-Area <String[]>] [-AssignmentCollection <SPAssignmentCollection>] [-Category <String[]>] [-ContextFilter <String[]>] [-Correlation <Guid[]>] [-EndTime <DateTime>] [-EventID <String[]>] [-ExcludeNestedCorrelation <SwitchParameter>] [-Level <String>] [-Message <String[]>] [-Overwrite <SwitchParameter>] [-Process <String[]>] [-StartTime <DateTime>] [-ThreadID <UInt32[]>]
Below are some example which will be helpful:
Example-1:
Merge-SPLogFile -Path "C:\Logs\FarmMergedLog.log" -Overwrite
Example-2:
Merge-SPLogFile -Path "C:\Logs\FarmMergedLog.log" -Overwrite -Area Search
Example-3: (merges the log data of level High or higher)
Merge-SPLogFile -Path "C:\Logs\FarmMergedLog.log" -Overwrite -Level High
Example-4: (merges based on a Correlation ID)
Merge-SPLogFile –Path “S:\SPLogs\MergedLogs.log” –Correlation 3ae2a6c0-da14-43a1-afda-5bb6bbff3d43 -Overwrite
Example-5: (Based on Time)
Merge-SPLogFile -Path "C:\Logs\FarmMergedLog.log" -Overwrite -StartTime "06/09/2008 16:00" - EndTime "06/09/2008 16:15"
Hope this will be helpful !!!