0

I'm running Promtail on Windows, using environment variables as described here: https://grafana.com/docs/loki/latest/clients/promtail/configuration/#use-environment-variables-in-the-configuration .

Here is my config.yaml:

client:
    external_labels:   
        instance: ${FOO}
        instance_id: ${BAR}

Now I set the two variables:

PS> $FOO="foo"
PS> $BAR="bar"
PS> echo $FOO
foo
PS> echo $BAR
bar

And then I start promtail with the flags --config.expand-env=true to use environment variable references in the configuration file and --print-config-stderr to get a quick output of the entire Promtail config.

However, the result is:

client:
  external_labels: |
    instance: ""
    instance_id: ""

The variables are not replaced as expected.

(I also tried the same with $Env:FOO and $Env:BAR)

How can I achieve this?

Thanks

iAmoric
  • 1,787
  • 3
  • 31
  • 64

1 Answers1

0

Try Modifying the config.yaml file to

client:
    external_labels:   
        instance: "${FOO}"
        instance_id: "${BAR}"
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 06 '23 at 00:22