Get original entry value in LogQL line_format

Viewed 3292

In LogQL line_format template expression, is there a way to access the original log entry (assume the entry is not in JSON or any parseable format and all labels are log labels and not extracted labels).

example: ... | line_format "{{.log_label1}}, {{.log_label2}}: {{<some way to show the entire original log entry>}}"

2 Answers

One way it to prepend it with a regular expression capturing the entire message

... |regexp '(?P<message>.*)' |line_format "{{.some_other_var}} {{.message}}"

Note that the ' around the regex should really by ` otherwise it might not work

It looks like instead of regexp you can use json parser:

... | json | line_format "{{.stream}}: {{.log}}"
Related