搬运工,撰写JSON记录驾驶员的标签/ env的
问题描述:
我一直在试图获取日志格式:搬运工,撰写JSON记录驾驶员的标签/ env的
{"log":"Using CATALINA_BASE: /opt/apache-tomcat-
7.0.76\r\n","stream":"stdout","time":"2017-04-
19T04:28:33.608418994Z","attrs":
{"production_status":"testing","os":"ubuntu"}}
我使用泊坞窗 - compose.yml:
version: '2.1'
services:
web:
image: hello-world/web:latest
container_name: api
ports:
- "80:8080"
logging:
driver: "json-file"
options:
max-size: 10m
max-file: "3"
labels: testing
env: ubuntu
但我不明白日志中的“attrs”键。我究竟做错了什么?
答
根据我的测试,有两件东西让标签/环境变量显示在日志中。
- 指定哪些标签/环境变量在日志中显示
- 将容器
因此,要得到你想要的,你需要设置docker-这些标签/环境变量compose.yml到:
version: '2.1'
services:
web:
image: hello-world/web:latest
container_name: api
ports:
- "80:8080"
logging:
driver: "json-file"
options:
max-size: 10m
max-file: "3"
labels: "production_status"
env: "os"
labels:
production_status: "testing"
environment:
- os=ubuntu
你知道吗? –