httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From htt...@karsites.net
Subject Re: [users@httpd] how can I add SERVER_NAME to a filename
Date Mon, 02 Jan 2006 17:02:50 GMT

Are you trying to add your own virtual server's name to your 
apache log filename? If so, read the discusion on how to log 
virtual hosts. You will find it on the manual home page under: 

Users' Guide-> LogFiles->Virtual Hosts.

You can then use the apache supplied perl script, 
split-logfile to do the following: 

>From the manual:

split-logfile

This perl script will take a combined Web server access log 
file and break its contents into separate files. It assumes 
that the first field of each line is the virtual host 
identity (put there by "%v"), and that the logfiles should 
be named that + ".log" in the current directory.

The combined log file is read from stdin. Records read will 
be appended to any existing log files.

Or you can set up logging for each specified virtual host 
like this:

<VirtualHost 10.1.2.3>
 DocumentRoot /www/docs/host.foo.com
 ServerAdmin robert@redcor.net
 ServerName projekte2.fh-aargau.ch
 CustomLog /var/log/apache2/projekte2.fh-aargau.ch/com_log combined
 ErrorLog  /var/log/apache2/projekte2.fh-aargau.ch/error_log
</VirtualHost> 

You will need to create the /projekte2.fh-aargau.ch/ 
directory under /var/log/apache2. This will keep logs for 
each virtual host seperate in their own sub-directory.


HTH - Keith Roberts 


On Mon, 2 Jan 2006, robert rottermann wrote:

> To: users@httpd.apache.org
> From: robert rottermann <robert@redcor.ch>
> Subject: [users@httpd] how can I add SERVER_NAME to a filename
> 
> Hi there,
> 
> I would like to
> use a construct like the following
> 
> ServerAdmin robert@redcor.net
> ServerName projekte2.fh-aargau.ch
> CustomLog     /var/log/apache2/%{SERVER_NAME}.log combined
> ErrorLog      /var/log/apache2/%{SERVER_NAME}.log
> 
> However, the filename it creates is %{SERVER_NAME}.log instead of
> projekte2.fh-aargau.ch.log
> 
> 
> how can I achieve the desired result?
> 
> thanks
> robert
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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


Mime
View raw message