Skip to content

Using docker container envrioment variables as loki log labels #13593

Answered by spencergilbert
dpewsey asked this question in Q&A
Discussion options

You must be logged in to vote

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 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.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dpewsey
Comment options

@spencergilbert
Comment options

@dpewsey
Comment options

@spencergilbert
Comment options

@dpewsey
Comment options

Answer selected by dpewsey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants