Have nginx access_log and error_log log to STDOUT and STDERR of master process

后端 未结 6 2066
一整个雨季
一整个雨季 2020-12-12 10:18

Is there a way to have the master process log to STDOUT STDERR instead of to a file?

It seems that you can only pass a filepath to the access_log directive:

6条回答
  •  半阙折子戏
    2020-12-12 10:52

    When running Nginx in a Docker container, be aware that a volume mounted over the log dir defeats the purpose of creating a softlink between the log files and stdout/stderr in your Dockerfile, as described in @Boeboe 's answer.

    In that case you can either create the softlink in your entrypoint (executed after volumes are mounted) or not use a volume at all (e.g. when logs are already collected by a central logging system).

提交回复
热议问题