Hi all,
How can I create dashboard that way so the label dynamically updates after adding/updating datasource ?
So in brief, my promtail loads all the files from /loki/logs dir, a lot of files under different directories for example:
/loki/logs/1111/mon/comblogs/*log
/loki/logs/1111/tues/comblogs/*log
/loki/logs/1111/wed/comblogs/*log
. .
/loki/logs/2222/mon/comblogs/*log
/loki/logs/2222/tues/comblogs/*log
. .
. .
... and so on
the promtail config is as follow:
- job_name: mycomblogs
entry_parser: raw
* static_configs:
- targets:
- localhost
labels:
job: mycomblogs
cluster: multipass-cluster
__path__: /loki/logs/*/*/comblogs/*log
everything works great, I can get specific logs and timeframes with regex like:
{job="mycomblogs", filename=~"/loki/logs/1111/.*.",filename=~".*.host1.all"} |~ "2022-03-29T11:16"
but I dont know how can I make dashboard that would show/point to /loki/logs/1111 directory as label and allow me to browse only files in 1111 dir? and when I add dir 8888 it would auto update the dashboard so I have labels 1111,2222…8888
Or is there any other way to sort those directories automatically and every time new directories are added the labels would reflect that ?
thanks in advance!