Re: [users@httpd] how can I add SERVER_NAME to a filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



keith,
thank you very much for your answer.
I was a bit unclear. I know that I can name the files like this

CustomLog /var/log/apache2/projekte2.fh-aargau.ch/com_log combined

however I would like to have the "projekte2.fh-aargau.ch" part
replaced by a variable.
Is this possible?

somehow %{SERVER_NAME} must be known as I use it in a rewrite rule.

thanks
robert

httpd2@xxxxxxxxxxxx wrote:
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@xxxxxxxxxx
 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@xxxxxxxxxxxxxxxx
From: robert rottermann <robert@xxxxxxxxx>
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@xxxxxxxxxx
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux