From owner-freebsd-apache@FreeBSD.ORG Wed Feb 27 00:00:31 2008 Return-Path: Delivered-To: apache@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DCEF1065672 for ; Wed, 27 Feb 2008 00:00:31 +0000 (UTC) (envelope-from tommyhp2@yahoo.com) Received: from web38211.mail.mud.yahoo.com (web38211.mail.mud.yahoo.com [209.191.124.154]) by mx1.freebsd.org (Postfix) with SMTP id B224313C467 for ; Wed, 27 Feb 2008 00:00:30 +0000 (UTC) (envelope-from tommyhp2@yahoo.com) Received: (qmail 77551 invoked by uid 60001); 26 Feb 2008 23:33:48 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=ERUY1hFb4c1bpADc25wnyjOZTgv/J91sErow6A454jZYWIkIwnObr7/LLlPekWZJKdG7A6H647tXOqjNnqiPv+7bbIJATOIPOI34GhUMdVLUjZsQyKj4Fkn4tCxqHDXH8LXY3WK6J62H7LSVzoTeSn59BBqgh+SZpl/6TPVXZBQ=; X-YMail-OSG: WqRJLBAVM1mmIyI1.4OTO8_2LqNHP5E1.djyuCv3v0vxnzgE Received: from [74.229.174.93] by web38211.mail.mud.yahoo.com via HTTP; Tue, 26 Feb 2008 15:33:48 PST Date: Tue, 26 Feb 2008 15:33:48 -0800 (PST) From: Tommy Pham To: apache@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <555072.41779.qm@web38211.mail.mud.yahoo.com> Cc: Subject: www/mod_log_sql2-dtc 's scoreboard broken? X-BeenThere: freebsd-apache@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Support of apache-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 00:00:31 -0000 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