Reduce WSS Logging Database size


Introduction :

Have you ever encountered a SharePoint farm on which you needed disk space ?
As far as I’m concerned, almost every farm I set up for development or testing purpose does not have much disk space, and quickly this space is filled up.
In fact, most of the time it’s the WSS Logging Database that is taking all the free space. Here is how to prevent this to happen.

Solution :

In a SharePoint Shell window under admin privileges, run the following command to list which entries are logged in the WSS Logging :

Then, the following command line will set all entries to 1 day retention, which should drastically reduce entries in the database :
Get-SPUsageDefinition | ForEach-Object {Set-SPUsageDefinition -Identity $ -DaysRetained 1}

You could check that everything is well configured by running again the Get-SPUsageDefinition command :

Usage Definition

Once it’s done, open SQL Management Studio and connect to the SharePoint Instance.
Then shrink the database. You should free dozens of GB in the process.

WSS Logging database size

References :

Don’t forget to have a look to official sources for more information :
– Get-SPUsageDefinition :
– Set-SPUsageDefinition :
– Information on the WSS_Logging database :


  1. Hello, i found i little type in your shell command.
    Get-SPUsageDefintion into Get-SPUsageDefinition

    Great article, keep it up.

  2. Pingback: SharePoint Logging Database Size on Development Environment | Raymond Little

Leave a Reply