Promtail Oauth config syntax

  • What Grafana version and what operating system are you using?
    Promtail 2.4.1

  • What are you trying to achieve?

Enable Oauth for loki client endpoint

  • How are you trying to achieve it?

change the promtail config

  • What happened?

I receive various parsing errors on start-up:

Unable to parse config: /etc/promtail/promtail.yaml: yaml: line 10: did not find expected ‘-’ indicator

Unable to parse config: /etc/promtail/promtail.yaml: yaml: unmarshal errors:
line 12: field client_id not found in type client.raw
line 13: field client_secret not found in type client.raw
line 14: field token_url not found in type client.raw

Unable to parse config: /etc/promtail/promtail.yaml: yaml: unmarshal errors:
line 14: cannot unmarshal !!seq into config.OAuth2

  • What did you expect to happen?

Oauth2 to be enabled

  • Can you copy/paste the configuration(s) that you are having problems with?

This is the config I expect to work:

clients:
  - url: LOKI_URL
  - oauth2:
    client_id: CLIENT_ID
    client_secret: CLIENT_SECRET
      - token_url: TOKEN_URL

But I have tried multiple other variartions (- in front of client_id/client_secret, no - in front of oauth2, no - in front of token_url, token_url not indented, brackets around client_id and client_secret.)

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

See Above

  • Did you follow any online instructions? If so, what is the URL?