On Sun, Aug 16, 2015 at 8:37 PM, David Aronchick <aronch...@gmail.com>
wrote:

> I'm trying to use httpd in a Docker container. As a general rule, I'm
> trying to write the access & error logs to stdio and stderr instead of
> writing them to disk. Is there a best practice here? I've tried posting to
> stackoverflow, and the best idea given was creating a symlink in the
> container. Is there a way to do this officially?
>
> http://stackoverflow.com/posts/32013582
>

The most efficient answer depends on your operating system. If you're on a
UNIX like system which provides /dev/stdout and /dev/stderr (or perhaps
/dev/fd/1 and /dev/fd/2) then use those file names. If that isn't an option
use the piped output feature. For example, from my config:

CustomLog "|/usr/sbin/rotatelogs -c -f -l -L
/private/var/log/apache2/test-access.log
/private/var/log/apache2/test-access.log.%Y-%m-%d 86400     " krader_custom
ErrorLog "|/usr/sbin/rotatelogs -c -f -l -L
/private/var/log/apache2/test-error.log
/private/var/log/apache2/test-error.log.%Y-%m-%d 86400"

Obviously you'll want to substitute another program for
/usr/sbin/rotatelogs in the example above that writes the data where you
want it to go.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Reply via email to