One thing that was lacking (in my opinion) from this article was a set of instructions or examples explaining how to schedule the TrimAuditLog command on a recurring basis. The article mentions Windows Task Scheduling, but the link in the same paragraph takes you to documentation about SharePoint Timer Jobs, which are for a different purpose and can't easily be used to do this anyway.
My suggestion if you wish to schedule this is to do it using Windows Task Scheduling as the article suggests. However, note that the date expected by TrimAuditLog isn't in the same format as what the %Date% variable or the 'date' command in Windows gives you.
Therefore, the approach I took was to create a small batch file that gets a date in the format expected by TrimAuditLog (by calling a utility called
getrelativedate) and then calls TrimAuditLog.
Here's what my batch file looks like:
@echo off
FOR /f %%a IN ('path\to\getrelativedate -60 yyyyMMdd') DO (
if errorlevel 0 (
"%CommonProgramFiles%\Microsoft Shared\web server extensions\12\bin\stsadm" ^
-o TrimAuditLog -date %%a -url http://path/to/sharepoint/site
)
)
I scheduled this batch file to run daily as a Windows Scheduled Task, and I pass "-60" to
getrelativedate to tell it to give me a date 60 days before the current date.
(Note: Despite what this article says, stsadm complains if you pass "enddate" as a switch to TrimAuditLog. Apparently, the actual name of the switch is "date," not "enddate.")
If you'd like to use this approach, download the
getrelativedate utility at the link below:
http://www.inclinetechnical.com/downloads/getrelativedate.zip