Docker GELF driver env option

筅森魡賤 提交于 2019-12-11 00:47:03

问题


Having an issue getting the --log-opt env=env1,env2 option to work with docker 1.12 swarm-mode and graylog. All of my logs are being sent fine and the tag is coming through. However I see nothing coming in at all from the env setting. I also tried using --log-opt labels=dev but had the same issue.

They are being shipped to graylog and I'm not seeing it anywhere within any of the log fields that come through. Any ideas on what I'm doing wrong here?

docker service create --log-driver=gelf --log-opt gelf-address=udp://logserver:12201 --log-opt tag="app-name" --log-opt env=dev ...


回答1:


I had the same issue and answered it here: https://stackoverflow.com/a/40182515/701260

When you use --log-opt env=dev, it will retrieve the variable dev from environment and include it in the event eg. dev: <val-from-env.

Labels do the same with docker labels.



来源:https://stackoverflow.com/questions/40030555/docker-gelf-driver-env-option

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!