How to display JSON log data in a collapsable way?

I am very new with using Grafana, apologies if I am missing something blatabtly obvious.

I have set up loki to collect json-serializaed structured log messages from a python app and I have managed to add a panel to a dashboard to visualize those messages.

However, the lines shown are just the raw JSON. I would have hoped that nested json is shown in a collapsable way so that one can drill into just those parts which are interesting?
When I choose the prettify json option the whole json data is shown in many lines, which is even worse.

The log entries contain a lot of detail information but I would like to initially only show the top fields and then expand those parts which may be of interest.

Is this possible at all? If so, how do I have to configure this?

This is currently only possible within the Table viz, with the inspect option turned on (and the table in Explore). Click inspect value for the log line field, and then open the code tab of the inspector drawer.


Admittedly not very convenient, but Grafana is actively working on better JSON logs support, so hopefully we’ll get a more ergonomic solution soon.

1 Like

Oh I see. For structured trace logs this is indeed not very convenient. I installed grafana/loki because there were various claims on the internet that loki would support collapsable structured log viewing, but the current way this is done in loki is not really what I need.