Access log/ statistics

PieterDC - January 14, 2009 - 00:11
Project:Services
Version:6.x-0.13
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

It would be nice to have a watchdog for services.

Why not use watchdog itself? Because web service request are not typical browser requests, they don't include a referrer, and so on. And I don't want to lose the log items (by cron), so that I can generate usage statistics per service method, API key, hour, ...

The attached patch is made using diff (without cvs) because otherwise I couldn't get the new files into the patch.
The services log module is made as a separate, optional module.

9 log levels are defined: SERVICES_STATS_UNKNOWNMETHOD, SERVICES_STATS_MISSINGREQUIREDARGUMENTS, SERVICES_STATS_EXPIREDTOKEN, SERVICES_STATS_USEDTOKEN, SERVICES_STATS_INVALIDHASH, SERVICES_STATS_INVALIDKEY, SERVICES_STATS_INVALIDSESSION, SERVICES_STATS_ACCESSDENIED, SERVICES_STATS_SUCCESS

I don't know if this is the best way to do it, but it works for me, for now.

AttachmentSize
20090114_services6.x-0.13_log.patch10.63 KB
20090114_services6.x-0.13_log.png22.79 KB

#1

marcingy - May 30, 2009 - 21:57

I quite like idea but I don't like the idea of having our own loging method simply because it prevents the module leveraging the ability of drupal core to allow for different logging methods. I would much rather see something based around hook_watchdog that provides the option for service specific logging. Ie if the type isn't services the method just ignores and continues.

#2

PieterDC - July 15, 2009 - 10:05

In my original post I explained why I think drupal core logging method (hook_watchdog) doesn't suit.
But I'd also prefer using drupal core or an existing (contrib) module...

Any hint, someone?

 
 

Drupal is a registered trademark of Dries Buytaert.