GreyZmeem / python-logging-loki

Python logging handler for Loki
MIT License
149 stars 58 forks source link

No Unique Label #15

Open rider8581 opened 3 years ago

rider8581 commented 3 years ago

I am pushing logs to loki and it is working nice. But when I show the log in Grafana, it is saying "no unique labels" Could you guide me how I can set the unique label? image

MartijnVanAndel commented 3 years ago

The unique labels are a feature of Grafana, comparing the unique labels of your query results. To set labels with python-logging-loki use the tags option in the examples. tags={"app_label": your_app_name_variable, "host": socket.gethostname()}

reformstudios commented 1 week ago

@MartijnVanAndel I'm confused about the use of tags and labels here. If you set tags, are these treated as loki Labels? and if so, isn't storing hostname as a label a label antipattern?

MartijnVanAndel commented 1 week ago

It's been quite some time I've been working with this. So don't know if some properties have changed over time. But at the time of writing in 2021 the following was the case:

So I wouldn't say best practice, but it solved label name requirements without programming.