apache 2.2.22(Ubuntu 12.04)上有多个 vhost 正在运行,我想将每个 vhost 错误日志发送到单独的 rsyslog 文件,以下是配置
阿帕奇虚拟主机
<VirtualHost *:80>
php_value auto_prepend_file sdemoqa.php
DocumentRoot /home/www//demoqa
ServerName sdemoqa.xyz.com
ErrorLog "syslog:local1"
CustomLog /var/log/apache/sdemoqa-access.log combined
RewriteEngine on
Include /nas/wow.conf
Include /nas/auth.conf
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/www/demoqa/hearing
ServerName shdemoqa.xyz.com
# ErrorLog /var/log/apache/hdemoqa-error.log
ErrorLog "syslog:local2"
CustomLog /var/log/apache/shdemoqa-access.log combined
</VirtualHost>
系统日志配置 /etc/rsyslog.d/50-default.conf
#Mod Security Logs
local1.* /var/log/apache2/modsec/sdemoqa.log
local2.* /var/log/apache2/modsec/shdemoqa.log
但是所有 vhosts 错误都重定向到 apache 配置中提到的 syslog 的第一个条目。我的意思是两个虚拟主机错误日志都将转到“local1.* /var/log/apache2/modsec/sdemoqa.log”
感谢 infosec.pk