ansible-role-grafana_agent icon indicating copy to clipboard operation
ansible-role-grafana_agent copied to clipboard

Breaking changes in Grafana agent config

Open josuablejeru opened this issue 2 years ago • 2 comments

Hello everyone!

Today I was doing some investigation regarding Loki because I couldn't get logs inside of Grafana Cloud. At the end the path passed inside of promtail-config.yaml.j2 has changed from /api/prom/push to /loki/api/v1/push.

Before I push a PR fixing this, it would be nice if someone could confirm my findings. My Grafana stack is only a couple of days old and could have only a new version with the breaking change. Also, my Instances are in eu-west-0 which could also behave differently for now.

After reading threw the Docs it seems like a lot of things have changed for agent-config.yaml This is what I'm using now and all my issues with Loki and Prometheus are resolved.

server:
  http_listen_port: 12345
  log_level: info

metrics:
  wal_directory: /tmp/grafana-agent-wal
  global:
    scrape_interval: 15s
    remote_write:
      - url: https://prometheus-{{ grafana_location_prometheus }}.grafana.net/api/prom/push
        basic_auth:
          username: {{ prometheus_user }}
          password: {{ grafana_api_key }}
  configs:
    - name: default
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: ['127.0.0.1:12345']

logs:
  configs:
  - name: default
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      - job_name: varlogs
        static_configs:
          - targets: [localhost]
            labels:
              job: varlogs
              __path__: /var/log/*log
    clients:
      - url: https://logs-prod-eu-west-0.grafana.net/loki/api/v1/push
        basic_auth:
          username: {{ loki_user }}
          password: {{ grafana_api_key }}

integrations:
  node_exporter:
    enabled: true

Your input is highly appreciated @nleiva

josuablejeru avatar Jul 16 '22 21:07 josuablejeru

Yeah, @bekriebel noticed another changed as well (https://github.com/nleiva/ansible-role-grafana_agent/commit/06306f4af136f242602c21e81ef8df4da75edac4). Feel free to submit a PR, I have not had a chance to test this myself yet.

nleiva avatar Aug 17 '22 16:08 nleiva

I can confirm this change. My setup did break too and your changes seem to resolve that! Thanks for looking into it.

localleon avatar Sep 23 '22 16:09 localleon