Extract logs from #SharePoint ULS logs #ProjectServer #PS2013 #SP2013
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011. I am also a certified Prince2 Practitioner. This article has been cross posted from pwmather.wordpress.com (original article) |
This post follows on from my previous post regarding the new log level manager functionality in Project Server 2013: http://pwmather.wordpress.com/2012/07/26/projectserver-ps2013-log-level-manager-sp2013-sharepoint-msproject-powershell/
Once configured, all activity on the farm for that particular entity, depending on the logging level set, is logged in the SharePoint ULS logs.
As mentioned in my last post, I said that I would create a simple PowerShell script that will extract the Project Server 2013 log level manager logs into a custom file to make it easier for viewing.
The script is available from the Microsoft Script Center below:
http://gallery.technet.microsoft.com/scriptcenter/Extract-logs-from-09b0e7bb
The script can be seen below with comments for configuration options:
# set the required date, below will set today, other days / dates can be
# used. For example, to get yesterdays logs use
# $Date = get-date -format "yyyyMMdd" (get-date).AddDays(-1)
$Date = get-date -format "yyyyMMdd"
# if you want logs from a specified date, remove the $Date variable from the where object
# and specify the string, for example for 27/07/2012 use:
# where-object {$_ -like "*20120727*"}
$files = Get-ChildItem "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS" | where-object {$_ -like "*$Date*"}
foreach ($file in $files)
{
# this script will copy any row that contains LogLevelManager!, to copy other
# logs, update the string in the where object, for example you could use the entity UID
get-content -path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS\$file" | where-object { $_ -match ‘LogLevelManager!’} | Out-File C:\PSLog$Date.txt -append
}
Running the script:
Creates a new text file in the specified location, in this example, the root of the C drive:
Whilst this script is aimed at extracting the Project Server log level manager logs, it could also be used to extract logs for other SharePoint applications. For example, you might have an issue with Excel Services and may want all of the Excel Services logs into a separate file while you investigate the issue.