Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Unique Label #15

Open
rider8581 opened this issue Jan 30, 2021 · 3 comments
Open

No Unique Label #15

rider8581 opened this issue Jan 30, 2021 · 3 comments

Comments

@rider8581
Copy link

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
Copy link

MartijnVanAndel commented Feb 15, 2021

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
Copy link

@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
Copy link

MartijnVanAndel commented Oct 14, 2024

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:

  • some of the labels of this package/loki have different names, compared to what grafana was expecting in it's default views, i.e. host vs hostname or log level/severity/verbose
  • no setting was available to rename these labels
  • tags in this package become indeed available as labels in Loki/grafana
  • by using the tags feature in this package you could hack the required label names in the system

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants