I'm looking for a solution that you can have :)
I try to exclude user-agent to apache log, but keep referer.
Here is what I tried
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\"" common
CustomLog ${APACHE_LOG_DIR}/xxx_access.log common
But when I do that, Referer
is excluded too ...
I tried to replace common
by combined
but still the same ...
And here is what I want to do:
IP - [date] "GET / HTTP/1.1" 200 9062 "Referer"
Any ideas?
It's not possible ... ?
combined
display both, Referer and User Agent
Am I doing it wrong?
Go into your /etc/apache2/apache.conf
(or apache2.conf
).
At the bottom you should see
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
So try to replace
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
by
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\"" combined
Restart Apache, and it should works.