Using docker container envrioment variables as loki log labels #13593
-
Looking to lift environment variables out of docker and use to define loki log labels. Wondering if anyone knows if this is possible.
I've tried with this and escaping out the characters. Anyone any ideas? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @dpewsey - to clarify, are the env variables in the container that Vector is running in - or are you looking for variables from the containers the logs were collected from? [sources.logs]
type = "docker_logs"
[sinks.loki]
type = "loki"
inputs = ["logs"]
endpoint = "http://url:3100"
encoding.codec = "json"
healthcheck.enabled = true
[sinks.loki.labels]
testing = '"${ENV}' The above would populate the The second part (getting variables from the container that generated the log) probably isn't possible. |
Beta Was this translation helpful? Give feedback.
Hi @dpewsey - to clarify, are the env variables in the container that Vector is running in - or are you looking for variables from the containers the logs were collected from?
The above would populate the
testing
label with an env var VAR, set in Vector's container (ref).The second part (getting variables from the container that generated the log) probably isn't possible.