Extract logs from #SharePoint ULS logs #ProjectServer #PS2013 #SP2013

July 30, 2012 at 12:14 pm | Posted in Administration, Customisation, Functionality, Information, PowerShell | 1 Comment
Tags: , , , , , , ,

This post follows on from my previous post regarding the new log level manager functionality in Project Server 2013: https://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:

image

Creates a new text file in the specified location, in this example, the root of the C drive:

image

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.

Advertisements

1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. […] This article has been cross posted from pwmather.wordpress.com (original article) […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: