首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >你如何从弗伦特获得码头标签?

你如何从弗伦特获得码头标签?
EN

Stack Overflow用户
提问于 2020-11-24 00:46:55
回答 1查看 811关注 0票数 1

我正试图将stdout/stderr从我的码头集装箱中转移到loki中。我有基本的工作原理,但我想用在我的client中定义的一个名为docker-compose.yaml的标记填充一个loki字段。

我的docker-compose.yml相关部分

代码语言:javascript
复制
  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剖面

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

发布于 2022-05-20 16:15:17

我对最初的配置做了一些修改,并提出了一些意见:

代码语言:javascript
复制
 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 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64978693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档