As I'm doing my testing, I noticed that the Apache Log format isn't
quite right. The logger doesn't log the query string of a request,
just the request itself. Apache logs the query string (%r = method,
path, query-string, protocol), where Cherokee skips the query-string
portion.
I've attached a patch that should fix this.
The 2nd patch (logger_host_patch) is something brought over from
Lighttpd. This may or may not be appropriate for logger_ncsa, but it
could be something that might work for logger_custom. If logger_custom
is to be used, it would be nice to be able to duplicate the same thing
with query-string as above. The current custom logger doesn't have a
way to add the '?' between the request and the query-string only when
query_string isn't blank. It (custom logger) is also missing a few
other things (timestamp, bytes sent, etc) that makes it seem this isn't
complete just yet.
The 3rd issue I'm having with the logfiles is that timezone is showing
up at +0000 instead of my timezone of -0500 (CDT). I'm on FreeBSD, so
this may be the issue. I don't have a patch for this at this point. In
messing with the timezone stuff, I also found out that timezones to the
west of GMT (such as -0500) will be displayed in the log as '--500'. I
think a simple abs() will fix this issue, but the lack of timezone for
people that don't have the timezone variable is a bit problematic.
Since I have tm_gmtoff, I was able to use localtime_r() to acquire the
timezone from the tm struct, but I don't think my code is ready for an
actual patch since it assumes that tm_gmtoff and localtime_r are both
available. I do see that you test for all these things, so I can get a
patch to you if you'd like.
Sincerely,
Jaime Bozza
--- logger_ncsa.c.orig 2009-03-31 10:16:15.000000000 -0500
+++ logger_ncsa.c 2009-03-31 10:17:43.000000000 -0500
@@ -262,6 +262,10 @@
cherokee_buffer_add (buf, method, method_len);
cherokee_buffer_add_char (buf, ' ');
cherokee_buffer_add_buffer (buf, request);
+ if (!cherokee_buffer_is_empty(&cnt->query_string)) {
+ cherokee_buffer_add_char (buf, '?');
+ cherokee_buffer_add_buffer (buf, &cnt->query_string);
+ }
cherokee_buffer_add_char (buf, ' ');
cherokee_buffer_add (buf, version, version_len);
cherokee_buffer_add_str (buf, "\" ");
--- logger_ncsa.c.orig 2009-03-31 10:16:15.000000000 -0500
+++ logger_ncsa.c 2009-03-31 10:21:56.000000000 -0500
@@ -254,7 +254,13 @@
* FMT_OFFSET
*/
cherokee_buffer_add (buf, ipaddr, strlen(ipaddr));
- cherokee_buffer_add_str (buf, " - ");
+ if (!cherokee_buffer_is_empty(&cnt->host)) {
+ cherokee_buffer_add_char (buf, ' ');
+ cherokee_buffer_add_buffer (buf, &cnt->host);
+ cherokee_buffer_add_char (buf, ' ');
+ } else {
+ cherokee_buffer_add_str (buf, " - ");
+ }
cherokee_buffer_add (buf, username, username_len);
/* " [date time] "
*/
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee