www/mod_log_sql2-dtc 's scoreboard broken?
Tommy Pham
tommyhp2 at yahoo.com
Wed Feb 27 00:00:31 UTC 2008
Hi everyone,
Is the port www/mod_log_sql2-dtc 's scoreboard broken? I have mass
vhost on with adequate rights (insert, update, create, select) where
required - the apache error log has no error and preserve file is
empty. Everything logs great except for the scoreboard. It inserts:
`vhost`, `month`, `year`, `count_impressions` ok but failed to update
properly?
here's the scoreboard table sample data:
domain vhost month year count_impressions bytes_sent
www default-domain.tld 2 2008 2 165632
www default-domain.tld 2 2008 3 248448
www default-domain.tld 2 2008 1 82816
is that how it's supposed to be? Is it supposed to query for an
existing `domain`,`vhost`,`month`,`year`, before any inserts? If the
matching the data exists, it updates `count_impressions` and
`bytes_sent` right? I thought the idea for this table is to see the #
of hits (ie count_impressions) and bandwidth used (bytes_sent) for the
month for each domain/vhost? If that's the case, then I think the
scoreboard is bugged because it's gonna fill up the scoreboard table
quickly with every hit/requests.
Here's the C code in file patch-mod_log_sql.c:
+ score_query_insert = apr_psprintf(r->pool,
"insert ignore into %s (domain,vhost,month,year,count_impressions)
values ('%s','%s','%s','%s','0')"
+
,scoreboard_table_name,scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
+
safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_insert);
+ score_query_update = apr_psprintf(r->pool,
"update %s SET count_impressions = count_impressions+1, bytes_sent =
bytes_sent+%s WHERE domain='%s' AND vhost='%s' AND month='%s' AND
year='%s'"
+
,scoreboard_table_name,extract_bytes_sent(r,
a),scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
+
safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_update);
I don't see a select statement to check for existing data. :( I
wouldn't mind fixing it and post the patch except my C coding sucks and
I don't know how use patch in FreeBSD :(
Also, the scoreboard table isn't created automatically with mass vhost
on with create rights. I had to create a table named 'scoreboard' with
the these fields.
Field Type Null Key Default Extra
domain varchar(20) YES MUL NULL
vhost varchar(20) YES NULL
month tinyint(3) unsigned YES 0
year smallint(5) unsigned YES 0
count_impressions int(10) unsigned YES 0
bytes_sent int(10) unsigned YES 0
Does anyone has any problems with the scoreboard? BTW, I'm using
Apache 2.2.8 on FreeBSD 7.0-RC2 amd64. The port is built without DBI.
Thanks,
Tommy
More information about the freebsd-apache
mailing list