As part of our upgrade I wanted to make sure that usage analysis was fully enabled and configured so that site collection administrators could track how their sites were being used. As there was no built-in stsadm command to do this I had to create my own: gl-setusageanalysis. Turns out that setting the usage settings via code is simple until you get to the point where you want to configure the advanced usage analysis and logging which is an SSP level configuration. With most SSP configurations this one has no public interface – fortunately it’s reasonably easy to use reflection to get at the code to make the change (a very simple method call – it’s beyond me why this isn’t made public – I’m starting to sound like a broken record but it’s extremely frustrating). The code is shown below:
The syntax of the command can be seen below:
C:\>stsadm -help gl-setusageanalysis stsadm -o gl-setusageanalysis Sets the usage analysis settings. Parameters: [-enablelogging <true | false>] [-enableusageprocessing <true | false>] [-logfilelocation <log file location>] [-numberoflogfiles <number of log files to create (0-30)>] [-processingstarttime <usage analysis start time>] [-processingendtime <usage analysis end time>] [-sspname <SSP name>] [-enableadvancedprocessing <true | false>] [-enablequerylogging <true | false>]
Here’s an example of how to enable usage analysis:
stsadm -o gl-setusageanalysis -enablelogging true -enableusageprocessing true -logfilelocation "c:\Logs" -numberoflogfiles 30 -processingstarttime "10:00PM" -processingendtime "1:00AM" -sspname SSP1 -enableadvancedprocessing true -enablequerylogging true
If you’ve changed any of the SSP related parameters then you may need to do an IIS reset before the changes show up in the browser.