You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Paul Sutton <pa...@ukweb.com> on 1996/07/05 09:57:55 UTC

multi log support

I've updated the config log module to be able to log to multiple log
files. This means it can effectively replace the referer and user-agent
log modules with a single line the config files, as well as making it
_much_ easier to add new custom log files, or change the format of these
logs (which at present requires code-hacking in the mod_log_* modules).

The module should be upwardly compatable with existing configs based on
either the common log or config log modules. It implements the existing
TransferLog and LogFormat directives. The only difference here is that
TransferLog can be given more than once and each request will be logged to
_all_ the log files. For example, to log request to two files in CLF
format, use:

  TransferLog logs/access_log
  TransferLog logs/another_access_log

As with the config log, LogFormat can be used to set the format for these
logs. Logging to two files in the same format isn't too useful, the
usefulness of this module comes from being able to log to multiple log
files in different format. To do this it adds a new directive CustomLog.
To log to a CLF file, and also keep a log of referers and user-agents, use

  TransferLog logs/access_log
  CustomLog   logs/referer    "%{referer}i -> %U"
  CustomLog   logs/agent      "%{user-agent}i"

Every request will now be logged to all three files, and it is trivial to
either add new log files, or change the format of the custom logs.  (The
%U is a new token to log the requested URI).

The referer and agent logs are not quite exactly the same as produced by
the existing modules: there is no RefererIgnore, and if the user-agent is
missing it is logged as '-' rather than ignored as with the agent log.
However I think the easy of use of this method of specifying multiple
custom log files makes up for this (alternatively, we could add some sort
of conditional-logging code).

Anyway, I've uploaded the module at mod_log_multi.c to httpd/incoming on
hyperreal.

Paul


Paul




Re: multi log support

Posted by ra...@madhaus.utcs.utoronto.ca.
> The module should be upwardly compatable with existing configs based on
> either the common log or config log modules. It implements the existing
> TransferLog and LogFormat directives. The only difference here is that
> TransferLog can be given more than once and each request will be logged to
> _all_ the log files. For example, to log request to two files in CLF
> format, use:
> 
>   TransferLog logs/access_log
>   TransferLog logs/another_access_log

One of the reasons people like mod_php is because it logs based on the
owner of the requested HTML file.  It shouldn't be extremely difficult
to add an option to your logging module to do this, and I think it might
be a very popular option.

mod_php also lets you log to an mSQL database which gives people the option
of asking complex questions of their logs with simple SQL queries.  That
may be a bit beyond the scope of your logging module though.

-Rasmus