How To Do Quick Search From SharePoint Logs

SharePoint logs are generated in all the servers in a farm. Thus, if you would like to find the log for your Application issue, you need to look into all the Servers in the farm. Now, you do not need to open ULS log file from each Server, as you can instead use Merge-SPLogFile powershell command in one Server to get ULS logs from the entire farm and investigate it.

Examples

  • Get the logs for the correlation in between the time range.

    Merge-SPLogFile -Correlation "E0BCS34790-9523-A353-046F-ABGD454ER4D4" -StartTime "06/23/2015 17:10" -EndTime "06/23/20 17:15" -Path "C:\temp\FarmMergedLog.log"
  • Get the Logs for the message 'deadlock' between the time range.

    Merge-SPLogFile -Message "*deadlock*" -StartTime "06/23/2015 17:10" -EndTime "06/23/20 17:15" -Path "c:\temp\FarmMergedLog2.log"

Once the Merge log file gets generated, you can open it in ULS Viewer.

One more interesting thing is that you can also filter Log files by specifying 'second' duration in the command. This is really required as thousands of logs are generated in a minute.

Example

Get the logs between the time range.

Merge-SPLogFile -StartTime "06/23/2015 17:10:15" -EndTime "06/23/20 17:10:45" -Path "c:\temp\FarmMergedLog3.log"

To know more in detail, please refer to the link.