Have nginx access_log and error_log log to STDOUT and STDERR of master process
Edit: it seems nginx now supports error_log stderr;
as mentioned in Anon's answer.
You can send the logs to /dev/stdout
. In nginx.conf
:
daemon off;
error_log /dev/stdout info;
http {
access_log /dev/stdout;
...
}
edit: May need to run ln -sf /proc/self/fd /dev/ if using running certain docker containers, then use /dev/fd/1
or /dev/fd/2
If the question is docker related... the official nginx docker images do this by making softlinks towards stdout/stderr
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
REF: https://microbadger.com/images/nginx