Apache - Syslog

Unless directly specified the file /etc/apache2/conf-enabled/other-vhosts-access-log.conf can host global log settings:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %v" combined_custom
CustomLog /var/log/apache2/access.log combined_custom
CustomLog "|/usr/bin/logger -t apache -p local6.info" combined_custom
ErrorLog "|$tee -a /var/log/apache2/error_log |/usr/bin/logger -t apache -p local6.info"

Saves separate files and combine access and error logs on /var/log/syslog facility local6
The first pipe is code for Apache to fork a new command, but it’s probably not forking a whole new shell, which would allow you to use a new pipe, but instead exec’ing the command, so everything is treated as a command argument, including the new pipe etc. You can likely go around it by wrapping it into a shell, using two methods, one is explicitly:
ErrorLog “|/bin/sh -c ‘tee … | logger …’”
And the other is implicitly, using the prefix keyword |$:
ErrorLog “|$tee … | logger …”
The root cause is a change in Apache 2.4, cf. http://httpd.apache.org/docs/2.4/upgrading.html:
On Unix platforms, piped logging commands configured using either ErrorLog or CustomLog were invoked using /bin/sh -c in 2.2 and earlier. In 2.4 and later, piped logging commands are executed directly. To restore the old behaviour, see the piped logging documentation.


Sources:

  • https://serverfault.com/questions/699122/apache-errorlog-piping-fail