Problem: In a multi-server SharePoint farm, if you need to trace an issue, you have to log in and review the ULS logs on each server in the farm. This process could be tedious in multi-server farms since you’re not sure on which server the error has occurred.
Use the Merge-SPLogFile PowerShell cmdlet.
The Merge-SPLogFile cmdlet will consolidate the logs from all servers in the SharePoint farm into a single log file. You can run it from any server and it gathers data from the entire farm – to find issues.
Here are some examples of Merge-SPLogFile:
Extract LOG from all SharePoint Servers matching correlation ID:
Merge-SPLogFile -path "D:\ErrorLog.txt" -Correlation "Your-error-correlation-id"
Use the above cmdlet to fetch ULS log for given correlation ID from all SharePoint servers in a multi-server farm. Here “path” refers to the log file name you want to create. If it already exists, use “overwrite” switch. This cmdlet looks for logs within past 20 Minutes of time span.
Merge-SPLogFile -Path D:\ErrorLog.txt -StartTime "20/10/2014" -overwrite
We can use parameters such as StartTime and/or EndTime parameters to specify the range of the log entries. There are other properties to help you narrow down the log search:
See the complete examples at Technet: Merge-SPLogFile Technet reference