How to configure nginx log to file and standard output at the same time in Kubernetes Ingress?

12/22/2016

I use nginx ingress controller in Kubernetes. In this nginx ingress controller, we create soft link to /var/log/nginx/access.log and error.log for stdout and stderr. In the nginx.conf, we config the log as follow:

    access_log /var/log/nginx/access.log
    error_log /var/log/nginx/error.log

With this configuration, the log can be viewed by "kubectl logs [pod name]". Now I want to get this log to be stored as a real file not only the standard output. How to achieve that?

-- passinger
kubernetes
nginx

0 Answers