Display Structured Logs in JSON Format From Loki as a Grafana Table#
Query#
{instance="$instance",compose_service="caddy"}
| json
Transform#
„Reduce“ to „ungroup“ the log lines („values“)
Series to rows
Count (must select an aggregate to make reduce work)
[x] Labels to fields
„Filter data by values“ to remove rows containing „id“ only
Include
Match all
Field „Field“ Match „Is equal“ Value „line“
„Add field from calculation“ to make „ts“ compatible with Table [1]
Binary Operation
ts
*
1000
(type, click create)
Alias: timestamp
„Organize fields“
Table override for human readable timestamp:#
„Add field override“
„Fields with name“: timestamp
„Add override property“
„Standard options > Unit“
apt-get update EXPKEYSIG
Grafana Variables