tstack / lnav

Log file navigator
http://lnav.org
BSD 2-Clause "Simplified" License
7.39k stars 299 forks source link

Cannot use `filter-expr` with field name containing `/` #1201

Open lbergnehr opened 10 months ago

lbergnehr commented 10 months ago

lnav version v0.11.2

Describe the bug In a json parser, if you have a known field named e.g. line/hostname it's not possible to filter on that column using filter-expr. It will say it's invalid format if you use :"line/hostname" = 'foo' or :line/hostname = 'foo'.

To Reproduce Use a parser that has nested json fields (also added as values in the parser definition) and parse a json log with it.

tstack commented 10 months ago

Indeed, I'm not sure the best way to go about this, unfortunately. However, I think you can do what you want by reading the value out of the raw JSON variable (:log_raw_text), like so:

:filter-expr jget(:log_raw_text, '/line/hostname') = 'foo'