我有一个在(希望很快成为)生产环境中运行的Deis集群,其中有很多不同的应用程序使用Dockerfile部署方法。一切都运行良好,但是除非我能得到一些有价值的日志输出,否则将这个系统提升到真正的生产环境(即转换 DNS)是不可能的。使用标准的Deis 日志平台,这里有一些 Web 命中的示例输出(有更多的输出,用于上下文):
Feb 10 01:46:04 ip-10-21-2-154.ec2.internal systemd[1]: Starting Generate /run/coreos/motd...
Feb 10 01:46:04 ip-10-21-2-154.ec2.internal systemd[1]: Started Generate /run/coreos/motd.
Feb 10 01:46:08 ip-10-21-2-154.ec2.internal docker[1867]: [info] GET /containers/json
Feb 10 01:46:08 ip-10-21-2-154.ec2.internal docker[1867]: [215084df] +job containers()
Feb 10 01:46:08 ip-10-21-2-154.ec2.internal docker[1867]: [215084df] -job containers() = OK (0)
Feb 10 01:46:09 ip-10-21-2-154.ec2.internal sh[1316]: 2015/02/10 01:46:09 set /deis/services/production-web/production-web_v8.cmd.1 -> 10.21.2.154:49409
Feb 10 01:46:12 ip-10-21-2-154.ec2.internal sh[9844]: 2015-02-10 01:46:12.302721 7f213ae14700 0 mon.ip-10-21-2-154.ec2.internal@4(peon).data_health(58) update_stats avail 80% total 102400 MB, used 17621 MB, avail 82542 MB
Feb 10 01:46:18 ip-10-21-2-154.ec2.internal docker[1867]: [info] GET /containers/json
Feb 10 01:46:18 ip-10-21-2-154.ec2.internal docker[1867]: [215084df] +job containers()
Feb 10 01:46:18 ip-10-21-2-154.ec2.internal docker[1867]: [215084df] -job containers() = OK (0)
Feb 10 01:46:19 ip-10-23-1-151.ec2.internal sh[1521]: [INFO] - [10/Feb/2015:01:46:27 +0000] - 10.21.2.179 - - - 200 - "GET / HTTP/1.1" - 4927 - "-" - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36" - "~^production-web\x5C.(?<domain>.+)$" - 10.21.2.154:49409
Feb 10 01:46:19 ip-10-21-2-154.ec2.internal sh[8468]: ===========
Feb 10 01:46:19 ip-10-21-2-154.ec2.internal sh[8468]: HIT TRACKER
Feb 10 01:46:19 ip-10-21-2-154.ec2.internal sh[8468]: SLUG: public/javascripts/bundle.js
Feb 10 01:46:19 ip-10-21-2-154.ec2.internal sh[8468]: ===========
这包含很多平台信息——如果我能过滤掉它,那真是太好了。问题在于源为 的所有行sh
,但具有不同的 PID。这些都是完全不同的容器:
1316
是 deis 出版商9844
是 deis-store-monitor1521
是路由器8468
是我的网络应用程序,生产网络
我发现这一点的唯一方法是 ssh 进入盒子并运行ps
. 更糟糕的是,如果我同时有来自其他容器的任何日志,它们也会显示为sh
——在具有多个活动应用程序都记录到同一流的生产环境中,这种情况显然是站不住脚的。理想的情况会sh
被 Docker 容器的名称所取代,或者最好是 Deis 应用程序的名称。
我翻阅了文档并深入研究了logspout和logger源代码,但我找不到任何解决此问题的方法。有没有机会在这里得到一些指示?