1 year ago

#261171

test-img

Simas Paškauskas

Docker-compose semi dynamic logging labels, useing special template markup

I was reading documentation and found this part and it got me wondering: is it possible to make a semi-dynamic labels on fluent bit? Did some research and labels part in documentation seems do indicate that this should be possible, but I can't find any examples or make it work on my own.

Let's say I have Kibana images that is driven by journald and fluent-bit later collects from it:

kibana:
      image: docker.elastic.co/kibana/kibana:7.13.0
      restart: always
      ports:
        - 5601:5601
      environment:
        - ELASTICSEARCH_HOSTS=http://10.10.10.10:9200
        - SERVER_PORT=5601
        - ELASTICSEARCH_USERNAME=${ELASTIC_USER}
        - ELASTICSEARCH_PASSWORD=${ELASTIC_PASS}
      logging:
        driver: journald
        options: 
          tag: "docker/{{.ImageName}}/{{.Name}}/{{.ID}}"
          labels: "15.15.15.15/{{.Name}}"  //could something like this be possible?
      labels:
        15.15.15.15/{{.Name}}: "fluentbit" //could something like this be possible?

All my services have prefixes/postfix, so kibana is actually more like -> my-cluster_kibana_1, where number at the end can change so adding label names manually is not a good option.

I did multiple tests, but seem to be unable to make something like this actually run and send the new label data.

Is something like this actually possible? And if so - how one should do it?

docker

logging

docker-compose

docker-logs

0 Answers

Your Answer

Accepted video resources