In https://github.com/grafana/loki/issues/4249 I found interesting screenshot.
On this screenshot I see that log level and message are displayed bold with white text and other metadata (collected from log message) displayed on separate line with grey color.
I have searched docs and haven't found how it's possible to achieve that. To be honest I'm searching for something like "short message" in ELK to make developers see metadata only when they are actually needs it. Could you please point me to the doc how to achieve that please?
Short answer: I found that there isn't such UI function in Grafana UI. But there's two features that can help you achieve such result:
Long answer:
{appname=~".+"} |= "HornetQ"
it produces following output.
{appname=~".+"} |= "HornetQ"
| json
| line_format "{{ .message }}"
But if you would open message details you would see all json fields anyway
We would use pattern '<_entry>'
to save initial json for further processing. Also we would use gotpl loop in line_format
and if
that would skip message field
{appname=~".+"} |= "HornetQ"
| pattern `<_entry>`
| json
| line_format "{{ .message }}\n{{ range $k, $v := (fromJson ._entry)}}{{if ne $k \"message\"}}{{$k}}: {{$v}} {{ end }}{{ end }}"
To achieve that we would use ANSI escape sequences (additional info)
{appname=~".+"}
| pattern `<_entry>`
| json
| line_format "\033[1;37m{{ .message }}\033[0m\n{{ range $k, $v := (fromJson ._entry)}}{{if ne $k \"message\"}}\033[1;30m{{$k}}: \033[0m\033[2;37m{{$v}}\033[0m {{ end }}{{ end }}"
You can see that |= "HornetQ"
part is missing in last query, that because it breaks last query (with colouring), so I skip it.
P.S. So for now my solution doesn't work with fulltext search :(