我正试图将stdout/stderr从我的码头集装箱中转移到loki中。我有基本的工作原理,但我想用在我的client中定义的一个名为docker-compose.yaml的标记填充一个loki字段。
我的docker-compose.yml相关部分
x-logging-defaults: &logging_defaults
logging:
driver: "fluentd"
options:
fluentd-address: 10.10.10.1:24224
tag: docker.application
labels: "client=the-client" # here?
labels:
- client=the-client # or here?fluent.conf剖面
<filter docker.**>
@type record_transformer
<record>
hostname "#{Socket.gethostname}"
# I think magic goes here, I've tried many variations
# of the following examples
client $.client
client $.docker.label.client
client ${ record.dig("labels", "client") }
</record>
</filter>
<match docker.**>
@type loki
url "http://loki.service.consul:3100"
<label>
client $.client # more magic here?
</label>
extra_labels {
"client": "or maybe here?"
}
</match>发布于 2022-05-20 16:15:17
我对最初的配置做了一些修改,并提出了一些意见:
x-logging-defaults: &logging_defaults
logging:
driver: "fluentd"
options:
fluentd-address: 10.10.10.1:24224
tag: docker.application
labels: "client" # In this section, you have to specify the allowed labels, that will be passed to the LogEntry.
labels:
- client=the-client https://stackoverflow.com/questions/64978693
复制相似问题