httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Bouthors <>
Subject Adding user log feature to mod_accounting
Date Fri, 13 Feb 2004 01:51:32 GMT

First of all, thank you for making mod_accounting, it's a very useful

I'm trying to add user log feature to mod_accounting (the one
configured by the "User" Apache directive) in order do get accounting
by user and not by vhost, we have many vhosts by user/client.

Here's a sample configuration:

<VirtualHost *>
 User drumcorpsnet
 Group users

I'm using User directive for suexec + php and I'd like mod_accounting
to use it to "UPDATE ... WHERE user='drumcorpsnet'". Each user has
more than one virtualhost.

I've made patch inspired by src/main/util_script.c:

libapache-mod-acct-0.5$ diff mod_accounting.c{.00,}
> #include <pwd.h>
> #include <sys/types.h>
> 				char *httpuser; // ="nobody";
> 				struct passwd *pw;
> 					case 'U':
> 						/* inspired from src/main/util_script.c */
> 						if ((pw = getpwuid(r->server->server_uid)) != NULL) {
> 						  httpuser = ap_pstrdup(r->pool, pw->pw_name);
> 						  query = ap_pstrcat( p, query, ptr, httpuser, NULL );
> 						}
> 						break;

httpuser is set, MySQL is successfully updated:

233 Query       UPDATE user SET byte_total=byte_total+78+3946, hit_total=hit_total+1 WHERE

Everything is working for a few hits but after that, Apache keeps on
making segfaults.  It can be easily reproduced with "ab -c500 -n2000":

[Fri Feb 13 02:07:36 2004] [notice] child pid 12536 exit signal Segmentation fault (11)
[Fri Feb 13 02:07:36 2004] [notice] child pid 12535 exit signal Segmentation fault (11)

Do you have any idea where the bug should come from?  The code is
coming almost straight from src/main/util_script.c but I really can't
see a bug, I'm not used to Apache nor multiprocesses environments...

Thank you for your time,
Cyril Bouthors

View raw message