Entry
i want to add to the log fle the REMOTE_ADDR variable how do i do it?
Nov 15th, 2001 15:29
Anthony Boyd, alon kadury,
Apache logs this by default, so you should already see it. It's the
first item on every line of your log file, probably an IP address but
maybe a domain name. However, if your logs do not currently have that,
you can add it. It's the "a" (IP address) or "h" (domain name)
condition letters. Find something like this in your httpd.conf file:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
That %h is it. You may see %a instead, or you can change it to %a if
you prefer. If you don't see it at all, just add it in. For example,
if your LogFormat looks like this:
LogFormat "%t %U" special
You can change it to this:
LogFormat "%t %U %a" special
Then restart the server, and it'll begin logging as you specified.