Re: Time of Request

Shawn Michael <smichael-icIElDLue0NWk0Htik3J/[email protected]> Tue, 15 Feb 2005 10:18:01 -0700
Newsgroups gmane.comp.apache.mod-log-sql
Organization RightNow Technologies, Inc.
Message-ID <[email protected]>
That's what apache provides by default.  Starting with apache 2.0 you do have the 
option of logging microseconds.  Back on Jan 25th I submitted a patch to the list 
that enables this option.  I have attached the patch here also.

Marius Karthaus wrote:
> Hi,
> Why is the 'T' (time of processing) defined as a smallint?
> Most requests end up as 0 or 1 not much info supplied like that.
> Whouldn't it be better to have it in microseconds?
> 
> Greets,
> Marius Karthaus
> LowVoice
> 
> _______________________________________________
> Download the latest version at 
> http://www.outoforder.cc/projects/apache/mod_log_sql/
> 
> To unsubscribe send an e-mail to 
> mod_log_sql-unsubscribe-7qY7E20V6GW73k+5HYS8LQqVMODqnSLI@public.gmane.org
> 

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Shawn Michael                                   smichael-icIElDLue0NWk0Htik3J/[email protected]
RightNow Technologies                           Hosting Administrator
                                  A Better Way to Serve your Customers

_______________________________________________
Download the latest version at http://www.outoforder.cc/projects/apache/mod_log_sql/

To unsubscribe send an e-mail to 
mod_log_sql-unsubscribe-7qY7E20V6GW73k+5HYS8LQqVMODqnSLI@public.gmane.org
microseconds.patch (text/x-patch, 3.6 KB)
diff -x .svn --recursive --unified mod_log_sql/contrib/create_tables.sql mod_log_sql.new/contrib/create_tables.sql
--- mod_log_sql/contrib/create_tables.sql	2004-11-24 15:34:22.000000000 -0700
+++ mod_log_sql.new/contrib/create_tables.sql	2004-11-24 15:16:04.000000000 -0700
@@ -23,7 +23,8 @@
 	ssl_maxkeysize smallint unsigned,
 	status smallint unsigned ,
 	time_stamp int unsigned ,
-	virtual_host varchar(255)
+	virtual_host varchar(255) ,
+    request_duration_ms int unsigned
 );
 
 create table notes (
diff -x .svn --recursive --unified mod_log_sql/functions20.h mod_log_sql.new/functions20.h
--- mod_log_sql/functions20.h	2004-11-24 15:34:24.000000000 -0700
+++ mod_log_sql.new/functions20.h	2004-11-24 15:06:12.000000000 -0700
@@ -96,6 +96,14 @@
 	return apr_psprintf(r->pool, "%" APR_TIME_T_FMT, apr_time_sec(duration));
 }
 
+
+static const char *extract_request_duration_microseconds(request_rec *r, char *a)
+{
+    return apr_psprintf(r->pool, "%" APR_TIME_T_FMT,
+                        (apr_time_now() - r->request_time));
+}
+
+
 static const char *extract_request_timestamp(request_rec *r, char *a)
 {
 	return apr_psprintf(r->pool, "%"APR_TIME_T_FMT, apr_time_sec(apr_time_now()));
diff -x .svn --recursive --unified mod_log_sql/mod_log_sql.c mod_log_sql.new/mod_log_sql.c
--- mod_log_sql/mod_log_sql.c	2004-11-24 15:34:24.000000000 -0700
+++ mod_log_sql.new/mod_log_sql.c	2004-11-24 15:09:55.000000000 -0700
@@ -490,6 +490,9 @@
     log_sql_register_item(s,p,'U', extract_request_uri,       "request_uri",      1, 1);
     log_sql_register_item(s,p,'v', extract_virtual_host,      "virtual_host",     0, 1);
     log_sql_register_item(s,p,'V', extract_server_name,       "virtual_host",     0, 1);
+#if defined(WITH_APACHE20)
+    log_sql_register_item(s,p,'D', extract_request_duration_microseconds,  "request_duration_ms", 1, 0);
+#endif
 
     if (global_config.announce) {
         ap_add_version_component(p, PACKAGE_NAME"/"PACKAGE_VERSION);
diff -x .svn --recursive --unified mod_log_sql/mod_log_sql_dbi.c mod_log_sql.new/mod_log_sql_dbi.c
--- mod_log_sql/mod_log_sql_dbi.c	2004-11-24 15:34:24.000000000 -0700
+++ mod_log_sql.new/mod_log_sql_dbi.c	2004-11-24 15:13:37.000000000 -0700
@@ -180,7 +180,8 @@
        ssl_maxkeysize smallint unsigned,\
        status smallint unsigned,\
        time_stamp int unsigned,\
-       virtual_host varchar(255))";
+       virtual_host varchar(255),\
+       request_duration_ms int unsigned)";
 		break;
 	case LOGSQL_TABLE_COOKIES:
 	case LOGSQL_TABLE_HEADERSIN:
diff -x .svn --recursive --unified mod_log_sql/mod_log_sql_mysql.c mod_log_sql.new/mod_log_sql_mysql.c
--- mod_log_sql/mod_log_sql_mysql.c	2004-11-24 15:34:24.000000000 -0700
+++ mod_log_sql.new/mod_log_sql_mysql.c	2004-11-24 15:37:52.000000000 -0700
@@ -210,7 +210,8 @@
        ssl_maxkeysize smallint unsigned,\
        status smallint unsigned,\
        time_stamp int unsigned,\
-       virtual_host varchar(255))";
+       virtual_host varchar(255),\
+       request_duration_ms int unsigned)";
 		break;
 	case LOGSQL_TABLE_COOKIES:
 	case LOGSQL_TABLE_HEADERSIN:
diff -x .svn --recursive --unified mod_log_sql/mod_log_sql_pgsql.c mod_log_sql.new/mod_log_sql_pgsql.c
--- mod_log_sql/mod_log_sql_pgsql.c	2004-11-24 15:34:24.000000000 -0700
+++ mod_log_sql.new/mod_log_sql_pgsql.c	2004-11-24 15:14:49.000000000 -0700
@@ -195,7 +195,8 @@
        ssl_maxkeysize smallint unsigned,\
        status smallint unsigned,\
        time_stamp int unsigned,\
-       virtual_host varchar(255))";
+       virtual_host varchar(255),\
+       request_duration_ms int unsigned)";
 		break;
 	case LOGSQL_TABLE_COOKIES:
 	case LOGSQL_TABLE_HEADERSIN:
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed