Trimauditlog: Stsadm operation (Office SharePoint Server)

Applies To: Office SharePoint Server 2007

This Office product will reach end of support on October 10, 2017. To stay supported, you will need to upgrade. For more information, see , Resources to help you upgrade your Office 2007 servers and clients.

 

Topic Last Modified: 2016-11-14

Operation name: Trimauditlog

Description

Lets an administrator delete audit entries older than a certain date, as specified by using the date parameter.

Note

This operation is available after the Infrastructure Update for Microsoft Office Servers is installed. This functionality is available only by using Stsadm.

Syntax

stsadm -o trimauditlog

**   -url <URL name>**

**   -date <YYYYMMDD>**

**   -databasename <database name>**

**\[-databaseserver\] \<database server name\>**

**   –orphanedentries**

Parameters

Parameter Value Required? Description

url

A valid URL, such as http://server_name

Yes, if databasename parameter is not specified

Specifies the URL name to a site collection. If you use this parameter, it will only delete the audit entries from that site collection. If this parameter is used, the databaseserver and databasename parameters are ignored.

date

A valid date in the form "YYYYMMDD"

Yes

Represents the earliest date and time for which the user wants to preserve audit data.

databasename (dn)

A valid database name, such as "DB1"

Yes, if url parameter is not specifed

Specifies the name of a content database where the audit log should be trimmed.

databaseserver (ds)

A valid database server, such as "DS1"

No

Name of the database server where the content database is stored.

Note

If your database server and SharePoint Products and Technologies are hosted on separate servers, you need to use the databaseserver parameter to specify the database server name.

orphanedentries

None

No

Trims the audit data that is missed when you run the Stsadm trimauditlog operation.

Note

The only time you need to use the orphanedentries parameter is when you delete a Microsoft Office SharePoint Server site collection and use the stsadm -o trimauditlog operation to trim the audit data but it misses some of the audit data.

Remarks

For situations in which you want to provide additional parameters beside a date to delete audit entries, see SPAudit.DeleteEntries Method (Microsoft.SharePoint) (https://go.microsoft.com/fwlink/?LinkId=121892&clcid=0x409).

If you want to export the current log before deleting it, custom code can be written using the SPAudit Class (Microsoft.SharePoint) (https://go.microsoft.com/fwlink/?LinkID=121893&clcid=0x409).

Important

The audit entries are permanently deleted after this operation has run.

An administrator can use Windows Task Scheduling to set this trim job to reoccur according to a defined period. For additional information about Windows Scheduling, see SharePoint Timer job reference (Office SharePoint Server).

Examples

Your audit log is growing too fast and you want to trim some entries from it. To specify a date of July 4, 2008, and the content database name WSSContent123456, you would use the following syntax:

stsadm -o trimauditlog –date 20080704 –databasename WSSContent123456

You delete a site collection and you need to trim the audit data. You first use the stsadm -o trimauditlog command but it misses some of the audit data. You need to use the orphanedentries parameter to trim all of the audit data. You can use either the databasename or databaseserver parameters to specify the database name or the name of the database server.

stsadm -o trimauditlog –orphanedentries –databasename <database name> [–databaseserver <database server name>]