2016-05-25 24 views
1

我在由supervisord管理的docker容器中运行nginx和独角兽。
所以,supervisord是docker的命令。它反过来产生nginx和独角兽。 Unicorn通过套接字与nginx对话。 nginx监听端口80.如何在漫游日志中停止dockerized nginx在前台?

我也有一个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

我试图禁用它。

到目前为止,我:

  1. nginx.conf和虚拟主机文件中设置access_logs /dev/null;

  2. 试图告诉supervisord停止记录请求

    [方案:nginx的] 命令= bash中-c “/ usr/sbin目录/ nginx的-c /etc/nginx/nginx.conf” stdout_logfile =的/ dev/null的 stderr_logfile =的/ dev/null的

  3. 试图告诉supervisord发送日志到syslog不标准输出:

    [方案:nginx的] 命令= bash中-c“/ usr/sbin目录/ nginx -c /etc/nginx/nginx.conf“ stdout_logfile =系统日志 stderr_logfile =系统日志

  4. 在Unicorn中将日志级别设置为Rails代码中的Warn,并通过env var。

完全supervisord的conf:

[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 

回答

0

你可以尝试change nginx log level有:

access_log off; 

的目标仍然是修改由nginx的影像中使用的nginx.conf