如何在前台阻止 dockerized nginx 泛滥日志?
how to stop dockerized nginx in foreground from flooding logs?
我 运行 nginx 和 unicorn 在由 supervisord 管理的 docker 容器中。
所以,supervisord 就是 docker 命令。它反过来会产生 nginx 和 unicorn。 Unicorn 通过套接字与 nginx 对话。 nginx 侦听端口 80。
我还有一个 logspout docker 容器 运行,基本上是通过监听 docker.sock 将所有 docker 日志传送到 papertrail。
问题是 nginx 不断地向日志中喷出数千个普通条目:
172.31.45.231 - - [25/May/2016:05:53:33 +0000] "GET / HTTP/1.0" 200 12961 0.0090
我正在尝试禁用它。
到目前为止我已经:
在 nginx.conf
和 vhost 文件中设置 access_logs /dev/null;
。
试图告诉 supervisord 停止记录请求
[程序:nginx]
命令=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf"
stdout_logfile=/dev/null
stderr_logfile=/dev/null
试图告诉 supervisord 将日志发送到系统日志而不是标准输出:
[程序:nginx]
命令=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf"
stdout_logfile=系统日志
stderr_logfile=系统日志
在 rails 代码中通过 env var 将 Unicorn 中的日志级别设置为 Warn。
完整的监督会议:
[supervisord]
nodaemon=true
loglevel=warn
[program:unicorn]
command=bundle exec unicorn -c /railsapp/config/unicorn.rb
process_name=%(program_name)s_%(process_num)02d
numprocs=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:nginx]
command=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf"
stdout_logfile=/dev/null
stderr_logfile=/dev/null
您可以尝试 change nginx log level 并使用:
access_log off;
目标仍然是修改 nginx 映像使用的 nginx.conf
。
我 运行 nginx 和 unicorn 在由 supervisord 管理的 docker 容器中。
所以,supervisord 就是 docker 命令。它反过来会产生 nginx 和 unicorn。 Unicorn 通过套接字与 nginx 对话。 nginx 侦听端口 80。
我还有一个 logspout docker 容器 运行,基本上是通过监听 docker.sock 将所有 docker 日志传送到 papertrail。
问题是 nginx 不断地向日志中喷出数千个普通条目:
172.31.45.231 - - [25/May/2016:05:53:33 +0000] "GET / HTTP/1.0" 200 12961 0.0090
我正在尝试禁用它。
到目前为止我已经:
在
nginx.conf
和 vhost 文件中设置access_logs /dev/null;
。试图告诉 supervisord 停止记录请求
[程序:nginx] 命令=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf" stdout_logfile=/dev/null stderr_logfile=/dev/null
试图告诉 supervisord 将日志发送到系统日志而不是标准输出:
[程序:nginx] 命令=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf" stdout_logfile=系统日志 stderr_logfile=系统日志
在 rails 代码中通过 env var 将 Unicorn 中的日志级别设置为 Warn。
完整的监督会议:
[supervisord]
nodaemon=true
loglevel=warn
[program:unicorn]
command=bundle exec unicorn -c /railsapp/config/unicorn.rb
process_name=%(program_name)s_%(process_num)02d
numprocs=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:nginx]
command=bash -c "/usr/sbin/nginx -c /etc/nginx/nginx.conf"
stdout_logfile=/dev/null
stderr_logfile=/dev/null
您可以尝试 change nginx log level 并使用:
access_log off;
目标仍然是修改 nginx 映像使用的 nginx.conf
。