Dependency for Loki dashboard variable

  • What Grafana version and what operating system are you using?
    version": "11.0.0 ubuntu server 22.04

  • What are you trying to achieve?

  • How are you trying to achieve it?

  • What happened?

  • What did you expect to happen?
    want to extract service logs from syslog using Promtail and Loki and visualize them in Grafana, organized by server.

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

    • job_name: syslog
      static_configs:
      • targets:
        • localhost
          labels:
          job: syslog
          host: “${HOSTNAME}”
          path: /var/log/syslog
          pipeline_stages:
      • regex:
        expression: ‘^(?P[^ ]+ [^ ]+ [^ ]+) (?P[^ ]+) (?P[^]+)(?:[\d+])?: (?P.*)’
      • match:
        selector: ‘{host=“${HOSTNAME}”}’
        stages:
        - labels:
        timestamp: “${timestamp}”
        host: “${host}”
        service: “${service}”
        message: “${message}”

I have two query variables in Grafana, one for ‘host’ and another for ‘service’. I want to filter the ‘service’ variable based on the ‘host’ selected. Currently, all services from all hosts appear in the ‘service’ variable regardless of the selected host, but I want it to display services specific to the selected host.

Thanks for the answer, I solved the problem like this: