MOnsDaR
MOnsDaR

Reputation: 8666

Loki and Grafana: Show the last log line for each label

I have a number applications that log their current version. Now I have these lines stored in Loki with the following structure:

Timestamp Labels Line
2024-06-10 {version_report=1, app=AppFoo} v1.0
2024-06-05 {version_report=1, app=AppBar} 24.1.0
2024-06-06 {version_report=1, app=AppBar} 24.1.1
2024-06-07 {version_report=1, app=AppBar} 24.1.2
2024-06-05 {version_report=1, app=AppBaz} Alpha
2024-06-10 {version_report=1, app=AppBaz} Beta

I'd like to create a Grafana dashboard that shows the last entry for each app-Label in a table, effectively giving me an overview what version has been running lately:

App Version
AppFoo v1.0
AppBar 24.1.2
AppBaz Beta

I've already experimented with different LogQL-queries and also restructuring the results with transformators. But in the end I cannot get the end-result I'd like to have. Is there a way to do it?

Upvotes: 1

Views: 298

Answers (0)

Related Questions