Project

General

Profile

Actions

Feature #373

closed

ISO 8601 date format in log files

Added by Anonymous over 19 years ago. Updated over 1 year ago.

Status:
Wontfix
Priority:
Normal
Category:
mod_accesslog
Target version:
-
ASK QUESTIONS IN Forums:
No

Description

Unambiguous, language independent, and space-saving - very important in log files. See also: http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html

Patch for mod_accesslog.c (version 1.3.16):


--- mod_accesslog.c.orig        2005-11-17 21:32:41.000000000 +0100
+++ mod_accesslog.c     2005-11-17 21:33:47.000000000 +0100
@@ -655,9 +655,9 @@
 #if defined(HAVE_STRUCT_TM_GMTOFF)
 # ifdef HAVE_LOCALTIME_R
                                        localtime_r(&(srv->cur_ts), &tm);
-                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S ", &tm);
+                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%FT%T", &tm);
 # else
-                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S ", localtime_r(&(srv->cur_ts)));
+                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%FT%T", localtime_r(&(srv->cur_ts)));
 # endif
                                        p->conf.ts_accesslog_str->used = strlen(p->conf.ts_accesslog_str->ptr) + 1;

@@ -677,9 +677,9 @@
 #else
 #ifdef HAVE_GMTIME_R
                                        gmtime_r(&(srv->cur_ts), &tm);
-                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S +0000]", &tm);
+                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%FT%T+0000]", &tm);
 #else
-                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%d/%b/%Y:%H:%M:%S +0000]", gmtime(&(srv->cur_ts)));
+                                       strftime(p->conf.ts_accesslog_str->ptr, p->conf.ts_accesslog_str->size - 1, "[%FT%T+0000]", gmtime(&(srv->cur_ts)));
 #endif
                                        p->conf.ts_accesslog_str->used = strlen(p->conf.ts_accesslog_str->ptr) + 1;
 #endif

-- dev at tallowitz.dot ch

Actions #1

Updated by moo about 19 years ago

looks good, mysql goes for iso date format too.

from man:


%F     Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)
%F conversion is in C99 and POSIX 1003.1-2001.

%T     The time in 24-hour notation (%H:%M:%S). (SU)
Single Unix Specification (marked SU)

anyone is familiar with %F %T compatibility? take care about cygwin/mingw build.

Actions #2

Updated by stbuehler over 16 years ago

  • Status changed from New to Fixed
  • Resolution set to wontfix

iirc the goal in accesslog was to be compatible too apache, so i don't think this is a good idea.

Actions #3

Updated by stbuehler over 16 years ago

  • Status changed from Fixed to Wontfix
Actions #4

Updated by gstrauss over 1 year ago

  • Description updated (diff)
  • ASK QUESTIONS IN Forums set to No

Additional accesslog time formats were added in lighttpd 1.4.40, including compact form unix seconds, though not $F %T.
See #2081

Actions

Also available in: Atom