How to Tee All Apache Logs To Console


I want to run apache so that all log messages show up on the console (or at least STDERR and/or STDOUT) because something is going wrong that isn't being logged in any file.

I'm currently sifting through an strace service apache2 start but that's a nuclear flyswatter approach to something that should be straight forward.

How can I do it?

The situation in more detail:

Apache responds with a 403 but even after an updatedb doing a locate error.log or locate error_log shows there are no updates to any log files for any virtual host. Nor is there any update to /var/log/apache2/suexec.log.

# apachectl -V
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/apache2.conf:222
Server version: Apache/2.4.10 (Debian)
Server built: Feb 24 2017 18:40:28
Server's Module Magic Number: 20120211:37
Server loaded: APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"

Best Answer

Apache httpd allows you to "pipe" your logs to any other program standard input.

CustomLog "| programtoreceivestandardinput parameters bla bla bla" common
ErrorLog "| programtoreceivestandardinput parameters"

Most httpd docker images also point to fd files like:

CustomLog /proc/self/fd/1 common