Powershell Command for cheking logs based on Correlation ID

For viewing in command promt
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | 
Format-List

 For viewing as log file as text file

get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | 
Format-List > C:\SPError.log

You can get faster results when I limit the time span .
 
Get-SPLogEvent -StartTime YYYY-MM-DDTHH:mm:ss | ?{$_.Correlation -eq "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
| select Area, Category, Level, EventID, Message | 
Format-List 

Get-SPLogEvent -StartTime YYYY-MM-DDTHH:mm:ss | ?{$_.Correlation -eq "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"} | select Area, Category, Level, EventID, Message | 
Format-List


4 comments:

  1. post examples.......

    ReplyDelete
  2. get-splogevent : The term 'get-splogevent' is not recognized as the name of a cmdlet, function, script file, or operabl
    e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + get-splogevent | ?{$_Correlation -eq "31e4719c-2f4e-f039-1cde-e675775e9aca" }
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (get-splogevent:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    ReplyDelete
  3. Mathewsun, you skipped dot between "$_" and "Correlation"

    ReplyDelete