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

Persistent, saved filters in config #949

Closed
nikess opened this issue Dec 16, 2021 · 3 comments
Closed

Persistent, saved filters in config #949

nikess opened this issue Dec 16, 2021 · 3 comments
Labels
enhancement Feature Request

Comments

@nikess
Copy link

nikess commented Dec 16, 2021

Often one has the need to filter log files for the same thing. E.g. warnings, or other domain specific things.

Currently one has to add these input filter regexes manually every time you open a log file.

Ideally these could be specified as global "favorites", or log format specific filters.

On opening a file, they would be disabled, but available. One would toggle them on in the usual way, as needed.

@nikess nikess added the enhancement Feature Request label Dec 16, 2021
@tstack
Copy link
Owner

tstack commented Dec 16, 2021

Many parts of lnav can be manipulated using the SQLite interface. In this case, you can create filters by inserting rows into the lnav_view_filters table. If you want to create these filters on demand, you can create an lnav script file and execute the script with the | hotkey. If you want them created on startup, you can put a SQL file in a format directory (e.g. ~/.lnav/formats/installed) with the statements to be executed.

As an example, the following SQL will create a disabled "OUT" filter for the log view that matches the phrase "noisy message":

INSERT INTO lnav_view_filters (view_name, enabled, type, pattern) VALUES ('log', 0, 'OUT', 'noisy message');

@piotr-dobrogost
Copy link

#811 would be handy here.

@tstack
Copy link
Owner

tstack commented Jun 13, 2022

With the addition of the events mechanism, I think this should all be possible now.

@tstack tstack closed this as completed Jun 13, 2022
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

3 participants