You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Elias <me...@nysun.com> on 2006/05/16 03:45:40 UTC

[users@httpd] Log File Name

Hi all -
 
I have a webfarm using a common httpd.conf for four machines connected
to a SAN. I would like to find a way to name the logfiles with the
hostname to identify what machine they came from.
 
I tried passing a shell variable like below;
CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/$HOSTNAME.%Y%m%d
86400" combined
 
CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/%V.%Y%m%d 86400"
combined
 
but it didn't work,. I get the literal not the variable.
 
The reason is I am using webtrends to for log analysis and they can't
have the same logfile name. When I upload them they are overwriting each
other because they have the same name.
 
Thanks for any help
 
Michael

Re: [users@httpd] Log File Name

Posted by Bill Jones <te...@gmail.com>.
On 5/15/06, Michael Elias <me...@nysun.com> wrote:
> I have a webfarm using a common httpd.conf for four machines connected to a
> SAN. I would like to find a way to name the logfiles with the hostname to
> identify what machine they came from.

> I tried passing a shell variable like below;
>
> CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/$HOSTNAME.%Y%m%d 86400"
> combined

> CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/%V.%Y%m%d 86400"
> combined

Ae you using VHost sections?  if so you will need to name each
individual log file the host name -- if not you are out of luck.  I
dont know of another way to name them.

-- 
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Log File Name

Posted by Brian Rectanus <br...@gmail.com>.
On 5/15/06, Michael Elias <me...@nysun.com> wrote:
>
> I have a webfarm using a common httpd.conf for four machines connected to a
> SAN. I would like to find a way to name the logfiles with the hostname to
> identify what machine they came from.
>
> I tried passing a shell variable like below;
>
> CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/$HOSTNAME.%Y%m%d 86400"
> combined
>
> CustomLog    "| /usr/sbin/rotatelogs /var/log/httpd/%V.%Y%m%d 86400"
> combined
>
> but it didn't work,. I get the literal not the variable.

Consider cronolog http://freshmeat.net/projects/cronolog/

You may need a wrapper script to resolve the host.  Something like this...

CustomLog "|/path/to/wrapper" combined


#!/bin/sh
# wrapper script
#
# Init and process any options here
#
exec /path/to/cronolog /var/log/httpd/`hostname`/%Y/%m/%d-access_log


-B

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org