title: How to log Apache errors to different syslog facilities for each virtual host?
body: <p>There are multiple vhosts are running on apache 2.2.22(Ubuntu 12.04), i want to send each vhost error logs to separate rsyslog file,
  Following are configuration</p>
  
  <p>Apache Vhost </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    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
  &lt;/VirtualHost&gt;
  
  
  &lt;VirtualHost *:80&gt;
    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
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Syslog config /etc/rsyslog.d/50-default.conf</p>
  
  <pre><code>#Mod Security Logs
  local1.*                        /var/log/apache2/modsec/sdemoqa.log
  local2.*                        /var/log/apache2/modsec/shdemoqa.log
  </code></pre>
  
  <p>But all vhosts error are redirect to first entry of syslog mentioned in apache configs. 
  I mean both vhosts error logs are going to "local1.* /var/log/apache2/modsec/sdemoqa.log"</p>
  
  <p>Thanks 
  infosec.pk</p>