Monday, July 25, 2016

Apache log format & log rotatelogs


Apache log format 

vim /etc/httpd/conf/httpd.conf

ErrorLog "|rotatelogs /mnt/logs/httpd/error-%Y-%m-%d.log 86400"
CustomLog "|rotatelogs /mnt/logs/httpd/access-%Y-%m-%d.log 86400" combined


CustomLog logs/access_log combined

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

LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

No comments:

Post a Comment