Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for space padded log lines #1391

Open
ConorMurphy21 opened this issue Feb 15, 2025 · 2 comments
Open

Support for space padded log lines #1391

ConorMurphy21 opened this issue Feb 15, 2025 · 2 comments
Labels
enhancement Feature Request

Comments

@ConorMurphy21
Copy link

Some log formats are space padded (like how json_lines might be displayed).

so a line might look like

12:00:00 INFO something happened

These formats are mostly fine in lnav, the problem is you :hide-fields level then the format looks like this:

12:00:00 ⋮ something happened

Which can be especially space wasteful if you hide multiple fields.

I think this could be relatively easily fixed by adding a property like "padded": "left|right" to a format (either global or per value), and then using that to delete the space to the left or right of a value when hiding that field.

@ConorMurphy21 ConorMurphy21 added the enhancement Feature Request label Feb 15, 2025
@tstack
Copy link
Owner

tstack commented Feb 15, 2025

I think this is technically possible now if you use a capture that wraps around the level the white-space. You can then hide that. Something like:

(?<level_column>(?<level>INFO|WARN|ERROR)\s+)

@ConorMurphy21
Copy link
Author

Interesting, yeah that's useful to know, I was considering including the space in the field itself but then it wouldn't parse properly. I think there still could be room to improve to improve this use case but that is a decent option. I guess that solution could allow a more generic handling of any formatting that is around a field.

With this solution it would be nice to have :show/hide-fields level hide the level_column as well / instead. And also to keep wrappers hidden in sql vtables so that results don't get bloated with doubled columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants