in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Jenny Everett

Living with SharePoint

Audit reports : Unknown Error

We have a site with a couple of document libraries, one is very large (~16 Gb |  25000 Files | 2500 Folders).  Smile

We have encountered a couple of problems, one of them is when you run Audit reports it returns "unknown error". It seems the bigger the site/document libraries the more likely you are to receive this. So we had to work out a way of getting Audit reports preferably without moving documents into new small document libraries.

So presumably this information is stored in the SharePoint databases? I like many others work on the premise that it is fine to read information out of these databases but DEFINATELY not to update these expect through the SharePoint interfaces.

So we went hunting and some time later.....

We found a table called AuditData (in the relevant Content DB), which contains most of the information required. We also used the UserInfo table to understand who performed the action.

AuditData contained most of the data - we were interested in the ItemType Column, UserID, DocLocation, Occurred, Event, EventData.

Some complicated data analysis later.... We established that everything we were interested in was ItemType 1 and the the Event could be used to determine what type of event. 

Check out 1
Check In 2
View 3
Delete 4
Update/Save 5

 

Therefore you can construct a query that brings back this information for individual sites, this is very basic and then needs some formatting applied.

SELECT     a.Event, u.tp_Login, a.Occurred, 'http://sharepoint/' + a.DocLocation AS [Document]
FROM         WSS_Content1.dbo.AuditData AS a INNER JOIN
                      WSS_Content1.dbo.UserInfo AS u ON a.UserId = u.tp_ID
WHERE     (a.DocLocation LIKE 'site/%') AND (a.ItemType = 1) AND (a.UserId <> '1073741823')

  • WSS_Content1 = relevant content db
  • http://sharepoint/ = your portal url
  • site/ = the site you are interested in this portal url
Published Nov 16 2007, 12:40 PM by JennyE
Filed under: , ,

Comments

 

RollingStone said:

Thanks for this post Jennie!  We're using Windows forms based authentication and I'm wondering if there's any way to link the actual user's name to the userid in the AuditData table.  also, how can I look up the actual site name as well?

Thanks very much.

January 8, 2008 3:52 PM
 

Dave said:

Just wondering, is there a way to shrink this table.

January 30, 2008 2:20 PM
 

Mindy said:

Wow, that's brilliant - you are my hero and savior since every time I try to run an audit report the portal stops responding and the reports error out anyway.

Thank you!!!!!

February 19, 2008 5:38 PM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts