[users@httpd] environment vars in Apache

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

 



Hi all!

I have a problem with Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.8b PHP/5.1.6 and environment viarables. I would like to pass the bash HOSTNAME variable to the apache logfiles. Therefore I have adjusted the httpd.conf as follows:

PassEnv HOSTNAME
LogFormat "%{HOSTNAME}e %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

The problem is however that when starting apache (whether from apachectl or httpd binary directly) it does not log HOSTNAME but logs a hyphen instead, also on startup it complains that the HOSTNAME was undefined:

$ /usr/local/apache2/bin/httpd -k start
[Wed Sep 20 12:54:46 2006] [warn] PassEnv variable HOSTNAME was undefined

However when I run apache as below then it does work:

HOSTNAME=www1 /usr/local/apache2/bin/httpd -k start

and apache does log the hostname to the logfile like I want it to. The (to me) weird thing is that the HOSTNAME var is set in the bash shell because when I invoke apache as follows it works as well:

HOSTNAME=$HOSTNAME /usr/local/apache2/bin/httpd -k start

I did have a look at /usr/local/apache2/bin/envvars but it seems that that is only called upon by apachectl which invokes httpd and since the issue arises with httpd that doesn't seem to be the problem. Can anyone tell me where to look?

Thanks!
Jonathan

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