0

i'm looking for a way to force apache server to log all client info based on custom logformat.

the issue arise when there are certain website were access through a reverse proxy. so have configure the logformat to be as follow:

LogFormat "%h %{X-Forwarded-For}i %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

but the logs are not be able to be process by awstat. what i am thinking is, can we do have two logformat.

LogFormat "%h %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{X-Forwarded-For}i %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" reverseproxy

and having some variable like if else condition. for example if i see request coming from 1.1.1.1 which is my reverse proxy ip then apache need to use reverseproxy logformat.

looking for expert reply.

0

You have exactly the example you need in the documentation: http://httpd.apache.org/docs/2.2/logs.html#accesslog

See the "Conditional Logs" section.

-1

maybe you could use /usr/bin/tee

We split our ErrorLog this way (to log the errors also to syslog):

ErrorLog "|/usr/bin/tee -a /var/log/apache2/error.log |/usr/bin/logger -t apache2 -p local1.info"
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.