3.2.1.3 收集应用日志
3.2.1.3.1 Apache日志
Apache本身支持通过 Syslog发送错误日志,我们又可以通过 Pipe形式,向 Syslog发送访问日志。
Apache配置如下。
CustomLog logs/access_log combined CustomLog "|/usr/bin/logger -t httpd -p local6.info" combined ErrorLog syslog:local7
Rsyslog配置如下。
if $syslogfacility-text == 'local6' and $programname == 'httpd' then
/var/log/httpd-access.log if $syslogfacility-text == 'local6' and $programname == 'httpd' then ~ if $syslogfacility-text == 'local7' and $programname == 'httpd' then
/var/log/httpd-error.log if $syslogfacility-text == 'local7' and $programname == 'httpd' then ~