Filter SharePoint log entries

Submitted by Robert MacLean on Thu, 02/05/2009 - 08:51

I often end up in the eventlog with SharePoint problems - since there is so much goodness there… um normally too much. So this trick of using PowerShell to filter the results and the export to a grid or CSV is very useful.

Get newest 20 SharePoint logs to a grid:

get-eventlog –logname Application –source ‘*sharepoint*’ –newest 20 | out-gridview

Export all SharePoint logs to CSV (perfect for Excel):

get-eventlog –logname Application –source ‘*sharepoint*’  | export-csv c:\eventlog.csv