Showing posts with label Kusal Pokala. Show all posts
Showing posts with label Kusal Pokala. Show all posts

Thursday, October 15, 2015

Viewing and filtering of ULS logs using powershell in Sharepoint 2013

SharePoint ULS logs can be filtered using powershell and generate grid-view, allows additional filtering. This can be handy to troubleshoot or searching with in ULS logs

Powershell script:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {     Add-PSSnapin "Microsoft.SharePoint.PowerShell" }

Get -SPLogEvent -StartTime "10/15/2015 11:19" -EndTime "10/15/2015 11:20" | out GridView

execution of the above powershell script opens a grid-view of the matching results. Grid-view has additional filtering capabilities.

Output can be written to a text file / log file using the following powershell command 

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {     Add-PSSnapin "Microsoft.SharePoint.PowerShell" }

Get -SPLogEvent -StartTime "10/15/2015 11:19" -EndTime "10/15/2015 11:20"  >> C:\ULSlogs.txt

 "Sorry, something went wrong"  message with correlation ID can be filtered and written to a text file /log file 

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {     Add-PSSnapin "Microsoft.SharePoint.PowerShell" }

Get-splogevent | ?{$_.Correlation -eq "<Correlation ID>"} | select Area, Category, Level, EventID,Message | Format-List > C:\ULSlogs.txt


by Kusal Pokala via Everyone's Blog Posts - SharePoint Community