On Debian 12.5 Bookworm, I want to write apache2 logs to stdout/stderr, so they can be collected by journald.
Per Writing Apache2 Logs to stdout/stderr?, I have the bellow config:
CustomLog /proc/self/fd/1 combined
ErrorLog /proc/self/fd/2
This works great when running apache2 in an alpine docker container, however I can’t get it to work on my Debian server. The journal outputs:
systemd[1]: Starting apache2.service - The Apache HTTP Server...
apachectl[1298583]: (6)No such device or address: AH00091: apache2: could not open error log file /proc/self/fd/2.
apachectl[1298583]: AH00015: Unable to open logs
apachectl[1298580]: Action 'start' failed.
apachectl[1298580]: The Apache error log may have more information.
systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: apache2.service: Failed with result 'exit-code'.
systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
Same issue if I use /dev/stdout
and /dev/stderr
. From a shell, all those files exists (/dev/stdout
, /dev/stderr
, /proc/self/fd/1
and /proc/self/fd/2
), but they are links that points to my tty. I would expect a daemon to see them too, although pointing to a different device.