Feeds:
Posts
Comments

Posts Tagged ‘usage data collection’

Hi all,

After a fresh installation (or upgrade from a MOSS 2007), there are a couple of configuration steps that need to be performed. One is the configuration of the usage and health data collection. This can be done either using the Central Administration or PowerShell. This post focuses on how to do the configuration using powershell.

 

As the very first step we would need to bring up the SharePoint 2010 Management Shell.

Then, by issuing the cmdlet:

 

Set-SPUsageService

 

we can specify multiple parameters in order to set the data collection up:

 

  • -LoggingEnabled (1 or 0)
  • -UsageLogLocation (file path)
  • -UsageLogMaxSpaceGB [1-20]

More parameters exist, however: these are the most interesting ones. So, for example, issuing the following command:

 

Set-SPUsageService –LoggingEnabled 1 –UsageLogLocation C:\Logs -UsageLogMaxSpaceGB 3

 

would enable the usage data collection and write the corresponding logs to C:\Logs, up to amount of 3 GB. Please bear in mind that the logs max space must be within the interval [1-20].

 

image

 

There is also a way of specifying the usage data collection for a single event type, using the following cmdlet:

Set-SPUsageDefinition

 

The parameters of interest are here:

  • -Identity <GUID>
  • -Enable
  • -DayRetained [1-30]

An example command would be like follows:

 

Set-SPUsageDefinition -Identity 0a79e3a1-c60d-473b-82b7-
f43c2b4da -Enable -DaysRetained 15

 

This would set the event type with the GUID to be kept in the logs for 15 days.

 

Until here, we could have done the same operations using the Central Administration. However, there is a configuration that can only be performed using PowerShell:

 

Usage Logging in a Different Database.

 

As we might have guessed, another cmdlet is needed for this operation:

 

Set-SPUsageApplication

It uses the following parameters of interest:

  • -DatabaseServer <Server>
  • -DatabaseName <DBName>
  • -DatabaseUsername <User>
  • -DatabasePassword <PWD>

The latter two parameters, –DatabaseUsername and –DatabasePassword, are only required if our DB user differs from the user we are currently logged on as.

 

What else there is to mention? Well, do test the above commands thoroughly before applying them in any productive environment. They affect the logging and hence may have a negative and severe impact if applied the wrong way (or just as they are –please DO NOT copy paste and execute them – the parameters need to be adapted to your needs).

 

For all three methods, there exists also an additional –Verbose parameter, that tells you about success or failure of the application.

 

Best regards & happy SP-configuring!

Martin

Read Full Post »