Promtail static_configs best practice for multiples paths

Hi,

is there any best practice for using static_configs for multiple files. I want to tail multiple logfiles from various locations.

This one works:

scrape_configs:
- job_name: grafana
  entry_parser: raw
  static_configs:
  - targets:
      - localhost
    labels:
        __path__: var/log/{loki,promtail}.log
        job: omd

But it does not work when i try to include folders like:

__path__: var/log/{loki,promtail,grafana/grafana}.log

Promtail simply ignores that entry completly.

  __path__: /var/log/*.log  # The path matching uses a third party library: https://github.com/bmatcuk/doublestar

try this path

__path__: var/log/**/{loki,promtail,grafana}.log
1 Like

if the log is in a different location, do I need to add another target? it’s not possible to do like this?

labels:
        __path__: 
           - var/log/{loki,promtail}.log
           - /var/log/smth/file.log

Hi, @yuswanulherlan . Did the YAML list on the __path__ attribute work?

no, it’s not.

i need to create another entry of target and set the job and the path

^ That works for me ( path: var/log/**/{syslog,kern}.log )
Screenshot 2024-10-15 132430