I've just started exploring Loki to aggregate my logs and I'm assuming I've missed something obvious.
I have a bunch of machines/vms/containers with promtail forwarding systemd's journal to a single loki server (just the default example config) and I can explore them just fine. I can filter the logs by any of the labels as required.
However, on a dashboard panel I have tried both the "table" and "logs" panel types and can't seem to do what seems extremely basic to me. I want filter by some of my labels and then extract one or more of the remaining labels as a column to be displayed. The closest I have found is to turn on "Unique labels" in the "logs" panel type which just throws all of the values in one column together.
What have I missed?
You can use the table panel type. Then go to the Transform
tab which is located next to the Query
tab at the bottom. Add an Extract fields
transformation and for the Source
dropdown select Labels
. Then press Add path
button and enter the name of the label you want as a column.
Note that there is also an Organize Fields
transform which is useful to control the visibility and ordering of columns.