Dear Grafana Community!
I am quite new in the world of Grafana and I am looking for showing metrics from log content parsed with Promtail to labels.
Did I get it right from the newsletter of the Loki 0.4.0 that via new Prometheus compatible API it is possible to do it?
If it is not necessary I would like to keep the tools I am using as minimum it is possible: Promtail, Loki, Grafana.
My use case would be to get out/parse metrics from log lines and show on Grafana. E.g. in every 10 seconds a new log line is appearing in log file showing some characteristics of the system like free memory, network usage, etc.
I am already able to parse the log lines with Promtail as labels and send to Loki.
Is is possible to reference only the labels by its name to show the values over time?
Hi Daniellee,
Thanks for the response! I have also checked the video but as far as I have understood the example it is possible to count the number of logs/second matching on a query.
My use case would be to show the value of the label I am choosing e.g.:
2019-11-18 17:39:01.000 memory_free 15
2019-11-18 17:38:01.000 memory_free 14
If I add to the Query section e.g. {memory_free=“15”} it selects the right entry from the Loki but the return object will contain 2 entries:
stream object with all of the labels using : “” form
values array of timestamp and whole log line.
How can I add to the graph the labels from stream object?
Assuming that you created a prometheus data source that points to your Loki instance - have you tested with the rate function. Does something like this work:
sum(rate({your_label="a_value"}[1m])) by (memory_free)
Thanks Danielle!
It seems I have misunderstood something regarding Loki.
I wanted to extract metrics from the logs and show it in Grafana while I am leaving out Prometheus from the game. As I have learnt the two tools shall work together efficiently.
How to plot a graph in grafana using a value which is present in my log.
My log looks something like this.
INFO 2021-05-15 09:15:30,752 - Greet-Client is Started , duration=0.003822803497314453s
I want to keep duration as my Y-axis. Can someone show some light on how to do this.
I have loki as my data source and these logs are coming from my Kubernetes app
Thanks in advance!! @ewelch