Grafana Loki - Question on labels from "Querying Logs" module

Hi,

I was going through “Query Logs” module of “Grafana Loki”.

In “promtail-local-config.yaml”, 2 labels were defined (as shown in “Promtail Installation” module - screenshot1.png):

job: varlogs
__path__:  /var/log/*log

However, when selecting values from “label filters” drop down in Grafana (at time 1:36 of the module), we see a label by the name “filename” (screenshot2.png).

Just wondering where is this label defined. Can someone please help.

Regards,
AR


Hi,

The label filename is added for every file found in __path__ to ensure the
uniqueness of the streams. It is set to the absolute path of the file the line
was read from.

You can read it here: loki/docs/sources/clients/promtail/scraping.md at 0fc934e4ea3ed76b995fd488a5fec3fab5a82886 · grafana/loki · GitHub

1 Like

@raymond.baoly

Thank you for the clarification and the reference to the explanation. It helped.

Regards,
AR