Mailing List Archive

Patch: Logfile extension
Hi!

I just tried out your new apache and it works fine!
Nevertheless I want to contribute this little patch
which enables to configure a logfile extension, i.e.
for each month or day or ...

Example: (What I am using)
httpd.conf: TransferLogExt -%y%m%d

This makes a logfile named "access_log-950411", each for one day ...

I hope you`ll find it useful and add it to the next release!
--

Ciao, Achim
-------------------------------------------------------------------
Achim Jung IRC: Flops junga@informatik.tu-muenchen.de
http://www.tu-muenchen.de/~junga/ flops@leo.org


*** http_config.c Tue Apr 11 08:07:07 1995
--- http_config.c.orig Sun Apr 2 16:39:35 1995
***************
*** 25,31 ****
char server_confname[MAX_STRING_LEN];
char access_confname[MAX_STRING_LEN];
char types_confname[MAX_STRING_LEN];
- char xfer_ext[MAX_STRING_LEN];
/* Apache keeps a list of pointer to custom responses */
char *response_code_strings[RESPONSE_CODES+1];
int timeout;
--- 25,30 ----
***************
*** 54,60 ****
make_full_path(server_root,DEFAULT_XFERLOG,xfer_fname);
make_full_path(server_root,DEFAULT_PIDLOG,pid_fname);
strcpy(server_admin,DEFAULT_ADMIN);
- strcpy(xfer_ext,"");
server_hostname = NULL;
make_full_path(server_root,RESOURCE_CONFIG_FILE,srm_confname);
/* server_confname set in httpd.c */
--- 53,58 ----
***************
*** 138,151 ****
else
strcpy(error_fname,w);
}
- else if(!strcasecmp(w,"TransferLogExt")) {
- cfg_getword(w,l);
- if(w[0] != '\0') {
- time_t t;
- t = time(NULL);
- strftime(xfer_ext, MAX_STRING_LEN, w, localtime(&t));
- }
- }
else if(!strcasecmp(w,"TransferLog")) {
cfg_getword(w,l);
if(w[0] != '/')
--- 136,141 ----
***************
*** 226,238 ****
}
}
}
-
- /*
- * cannot do it earlier or I would have to do it more than
- * once in TransferLog and TransferLogExt
- */
- strncat(xfer_fname, xfer_ext, MAX_STRING_LEN);
-
fclose(cfg);
}

--- 216,221 ----
Re: Patch: Logfile extension [ In reply to ]
On Tue, 11 Apr 1995, Achim Jung wrote:
> I just tried out your new apache and it works fine!
> Nevertheless I want to contribute this little patch
> which enables to configure a logfile extension, i.e.
> for each month or day or ...
>
> Example: (What I am using)
> httpd.conf: TransferLogExt -%y%m%d
>
> This makes a logfile named "access_log-950411", each for one day ...
>
> I hope you`ll find it useful and add it to the next release!

I think most of us agreed (which talking about log file functionality and
such) that we could go overboard in putting special log file features
into the server, but we'd never be able to do everything everyone could
want to do, and it could slow down performance - a much better
alternative is to simply use other programs to manage the log file
archiving and such. For example, the functionality you describe above
could be done using a 4-line perl script thrown into a crontab. It could
behoove us to include some example scripts like this in the /utils
directory - or maybe a /contrib directory? Hmm....

Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@hotwired.com brian@hyperreal.com http://www.hotwired.com/Staff/brian/