Sunday, 15 January 2012

docker - supervisord: is it possible to redirect subprocess stdout back to supervisord? -



docker - supervisord: is it possible to redirect subprocess stdout back to supervisord? -

i'm using supervisord entry point docker containers described in https://docs.docker.com/articles/using_supervisord/, want logs written stdout can take advantage of builtin tools docker logs or systemd's journal, if running containers on coreos.

for stderr there's redirect_stderr=true alternative subprocesses, possible redirect subprocess stdout supervisord somehow , not deal actual log files ?

you can redirect program's stdout supervisor's stdout using next configuration options:

stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0

explanation:

when process opens /dev/fd/1 (which same /proc/self/fd/1), scheme clones file descriptor #1 (stdout) of process. using stdout_logfile hence causes supervisord redirect program's stdout own stdout. stdout_logfile_maxbytes=0 disables log file rotation not meaningful stdout. not specifying alternative result in error because default value 50mb , supervisor not smart plenty observe specified log file not regular file.

for more information:

http://veithen.github.io/2015/01/08/supervisord-redirecting-stdout.html

docker supervisord coreos

No comments:

Post a Comment