Hi there. I've set up a site where varied users will be able to create accounts and create content The site owners would like to be able to see a log of activity on the site, including account creation, login, uploading/editing of content and uploading files. My solution to this was to allow them access to the reports/dblog page of the admin section, where they can see all of this.

What I'd like to do now is to give them the ability to download a log of system events in a separate file, say a csv or text file. I can't see any setting in Drupal that allows this though. Can anyone help? Is there such a function in Drupal, perhaps a non-core module?

thanks in advance!


ishmael-sanchez’s picture

If you have views installed you can install Views Watchdog which will expose watchdog messages to views and then using Views Bonus Pack you can make this an exportable file.

Also you can restrict the views based on role or permission then you can disable your users access to site reports.

Mr Cronk’s picture

Cheer Ishmael, I'm making progress with this. My next problem is applying filters to the view. I'd like to bring back only certain events (this is for users after all) so they don't have to filter out everything else. My approach so far has been to filter on Type = User or Type = Content. This isn't really specific enough for my needs though, so I'd like to filter again on Message.

Below is a typical watchdog record output. The particular node type I'd like to filter on is a custom node type, "Trial". When I put the word "trial" in as a message filter though, the view does not include the node type as being part of the message text. So filtering on "trial" will not bring the below record back. I've scoured the entire log looking for common words for all the events I'd like to bring back and I don't think there are any others. Can anyone suggest how I can search on node type?

A second problem is that I'd like to apply a different message filter to Type=User and Type=Content. Is it possible to create a combined view, which combines one message filter on user type and a different one on content type?


Custom text:
View result counter: 36
Link: view
Location: http://localhost/testsite/?q=node/add/trial
Message: trial: added Test New Project.
Referrer: http://localhost/testsite/?q=node/add/trial
Timestamp: 03/22/2011 - 02:29
Type: content
Wid: 181
ishmael-sanchez’s picture

I have never used views watchdog but I'm pretty sure you should be able to add some exposed filters similar to the dblog page.

Mr Cronk’s picture

Looking further at this, I notice that the normal dblog seems to present the records better. It also contains a filter which allow users to set Type=Content and/or Type=User. This looks like a better option at first. Is it possible to set up the normal dblog to download as a csv file?

The log is found at ?q=admin/reports/dblog