docker + syslog +管理员日志记录问题

时间:2019-01-30 11:37:49

标签: docker tomcat vmware tomcat8 supervisord

我正在尝试将tomcat和apache日志发送到集中式系统日志。不幸的是,在尝试了许多先前的解决方案之后,它没有解决问题。

提示:我正在使用主管启动服务

我尝试了以下操作:

1-将所有主管日志转发到标准输出

2-将CATALINA_OUT更改为stdout,并将Apache error_log也更改为stdout,但没有解决

3-然后在构建之前,我也在docker-compose中设置了以下env:

SYSLOG_SERVER=ip address
SYSLOG_PORT=514
SYSLOG_PROTO=udp

注意:我使用的是VMware集成容器(Vic),但我不认为这是问题所在,因为其他容器(不使用管理程序)都可以正常登录到stdout

[supervisord]
nodaemon=true
logfile=/dev/stdout
loglevel=debug
logfile_maxbytes=0
[program:apache]
command=/usr/sbin/httpd -D FOREGROUND
autostart=true
autorestart=true
startsecs=5
logfile_maxbytes=0
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stdout

[program:tomcat]
command=/opt/cmaas/portal/bin/catalina.sh run
autostart=true
autorestart=true
startsecs=5
logfile_maxbytes=0
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stdout

尝试了此http://mneilsworld.com/discussion/supervisord-docker-and-loggly并安装了超级用户日志,并为正确的syslog服务器放置了正确的env变量,但没有解决

我当前启动我的服务的主管代码是:

[supervisord]
nodaemon=true
[program:adjust_configuration]
command=/usr/local/bin/confd -onetime -backend env
autostart=true
autorestart=true
startsecs=5
[program:copy_setenv]
command=/usr/bin/sh -c "/opt/cmaas/portal/conf/setenv.sh > 
/opt/cmaas/portal/bin/setenv.sh" && /usr/bin/chmod +x 
/opt/cmaas/portal/conf/setenv.sh
autostart=true
autorestart=true
startsecs=5
[program:ssh]
command=/usr/sbin/sshd -D
autostart=true
autorestart=true
startsecs=5
[program:apache]
command=/usr/sbin/httpd -D FOREGROUND
autostart=true
autorestart=true
startsecs=5
stdout_events_enabled=true
stderr_events_enabled=true
[program:tomcat]
command=/opt/cmaas/portal/bin/catalina.sh run
autostart=true
autorestart=true
startsecs=5
stdout_events_enabled=true
stderr_events_enabled=true
[program:adjust_permissions]
command=chown -R cmusr:cmusr /opt/cmaas
autostart=true
autorestart=true
startsecs=5
[eventlistener:logging]
command=supervisor_logging
events=PROCESS_LOG

有什么想法可以让主管将其日志发送到特定的syslog服务器,以及如何做到这一点?

0 个答案:

没有答案