mdegat01 / addon-promtail

Promtail for Home Assistant
MIT License
17 stars 20 forks source link

Add a prefix to logs/jobs #224

Open DST73 opened 6 months ago

DST73 commented 6 months ago

Is your feature request related to a problem? Please describe. My problem is, that I have two HA server logging to the same loki docker instance. My problem is, that I now can’t distinguish from witch HA the messages are coming from. Is there a way to add a prefix or something that I can use to filter?

Describe the solution you'd like A way to add a prefix to the log or job or something I can filter for within grafana

Thank you!

Bierchermuesli commented 1 week ago

override the default scrape config (additional_scrape_configs and skip_default_scrape_config like so?


  - job_name: journal
    journal:
      json: false
      max_age: 12h
      labels:
        job: systemd-journal
        instance: whateveryourhostnameis.com
      path: "${JOURNAL_PATH}"
    relabel_configs:
      - source_labels:
          - __journal__systemd_unit
        target_label: unit
      - source_labels:
          - __journal__hostname
        target_label: nodename
      - source_labels:
          - __journal_syslog_identifier
        target_label: syslog_identifier
      - source_labels:
          - __journal_container_name
        target_label: container_name
    pipeline_stages:
      - match:
          selector: '{container_name=~"homeassistant|hassio_supervisor"}'
          stages:
            - multiline:
                firstline: '^\x{001b}'

basically just add a instance label?