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

An option to exclude files and directories implied by -r (recurse) option #1258

Open
metablaster opened this issue Apr 19, 2024 · 14 comments
Open
Labels
enhancement Feature Request

Comments

@metablaster
Copy link

metablaster commented Apr 19, 2024

Is your feature request related to a problem? Please describe.

Using -r option to recurse into directory will pick up all files and directories including those one might now want to load.

A solid example is lnav -r /var/log which will also load /var/log/journal logs but those are undesired to be loaded first because journal is better piped to lnav and secondly because it will significantly slow down loading of log files.

And unless I'm wrong journal entries are nothing but duplicate of already present and loaded files from /var/log

Describe the solution you'd like

An option to exclude files and directories when -r option is used

Describe alternatives you've considered

I'm not aware of any alternatives other than writing a long line of directories and files which to explicitly load.
If you know of a better method as a workaround please share!

Additional context

I think the option to exclude files or directories should not be limited to the use of the -r option because one might want to exclude certain files when not recursing.

@metablaster metablaster added the enhancement Feature Request label Apr 19, 2024
@tstack
Copy link
Owner

tstack commented Apr 20, 2024

A solid example is lnav -r /var/log which will also load /var/log/journal logs but those are undesired to be loaded first because journal is better piped to lnav and secondly because it will significantly slow down loading of log files.

Can you attach an lnav debug log (run lnav with -d /tmp/lnav.dbg) when you're doing this.

I did a quick test with a system I had on hand and since the files in journal are binary, lnav will ignore them. So, it doesn't really slow down loading.

@metablaster
Copy link
Author

metablaster commented Apr 20, 2024

@tstack
Thank you for response!

Can you attach an lnav debug log (run lnav with -d /tmp/lnav.dbg) when you're doing this.

I have run the command sudo lnav -d /tmp/lnav.dbg -r /var/log and here is the compressed file as requested:

lnav.dbg.tar.gz


I did a quick test with a system I had on hand and since the files in journal are binary, lnav will ignore them. So, it doesn't really slow down loading.

In my case the above command took some 3 minutes to finish loading files, and it is visible from the Configuration Panel that the journal files are processed most of the time, I can't tell if they're being loaded but it surely takes a lot of time to process them.


Additional info:

System: Debian 12.5 bookworm

lnav -V

lnav 0.11.1

@tstack
Copy link
Owner

tstack commented Apr 20, 2024

Ah, I was testing with the v0.12+, lnav v0.11.1 is slow for me as well. Are you able to upgrade to either v0.12.1 or there is a beta for the v0.12.2 release:

https://github.com/tstack/lnav/releases/tag/v0.12.2-beta1

@metablaster
Copy link
Author

I have tested v0.12.2-beta1 in my VM and can confirm loading is as fast as it should be, so that problem is solved.

The only problem I spotted is ENTER key moves focus line instead of invoking breadcrumb bar menu, I guess the default keymap was changed?

Are you able to upgrade

Sadly I don't practice installing software that is not from Debian's repo on my main machine but it's not a big deal, I wish newer version to be available in Debian's backports, is that possible?


While the issue with loading speed is solved, I think the option to exclude files and directories with -r option would be nice addition to lnav regardless, what do you think?

@tstack
Copy link
Owner

tstack commented Apr 21, 2024

The only problem I spotted is ENTER key moves focus line instead of invoking breadcrumb bar menu, I guess the default keymap was changed?

The backquote character is now used to focus on the breadcrumb bar. The change was mentioned in the NEWS.md file and is shown in the top-right after startup.

I wish newer version to be available in Debian's backports, is that possible?

I don't maintain OS packages. You could try using the snap version, which I do maintain.

I think the option to exclude files and directories with -r option would be nice addition to lnav regardless, what do you think?

I think some other tools support more sophisticated glob patterns that allow you to write exclusions, I'll look into doing something like that.

@metablaster
Copy link
Author

I'll look into doing something like that.

OK, you close this issue if no decision to implement option to exclude, for me this is solved.
Thank you for support, and thank you for great software!

@FaffeF
Copy link
Contributor

FaffeF commented Apr 21, 2024

The backquote character is now used to focus on the breadcrumb bar

Sorry, but I'm not in love with this. On a Swedish keyboard that means pressing shift-' space, which is anything but intuitive and fast.

@tstack
Copy link
Owner

tstack commented Apr 21, 2024

@FaffeF can you recommend an alternative? I found ENTER to be too easy to press and was activating the bar when I didn’t want to.

@metablaster
Copy link
Author

metablaster commented Apr 21, 2024

@FaffeF
On my keyboard which is also not English I have to press Alt Gr + 7 however there is straight key for backtick which is the one left of 1 or ~ (don't know how that one is called).

I didn't know this for a very long time until recently, you might as well find the key on your keyboard by trying out.

@tstack
I think a more appropriate and cross--language-keyboard friendly would be SHIFT + TAB because since TAB is used for file filtering which is Configuration panel then it logically makes sense because Breadcrumb Bar is same thing except at the top of UI.

And beside that pressing SHIFT + TAB is easy because you can use both hand fingers to press and the keys are easy to access on blind typing.

Or if it has to be single key, then Ins (insert) key, is also not hard to type and is cross-language friendly.
Both of these are not assigned from what I see on docs

@FaffeF
Copy link
Contributor

FaffeF commented Apr 21, 2024

@FaffeF can you recommend an alternative?

I'm guessing the whole point of this is to use the "quake" key, i.e. the key to the left of 1. Checking different keyboard layouts, I see there are quite a few different symbols located there, where we in the Nordics seem to have settled on the section mark §, sorry @metablaster.

A thought that occurred to me is that there may be some key people expect the menu bar to be available at, rather than backtick? F10 seems to be more or less standard in Windows applications. Alt+space also comes to mind.

This is quite a similar issue to my old one #1066, and I could try to author another pull request. Mabye I could check the other available keymaps as well.

And sorry for kidnapping the thread, this should be a separate issue.

@tstack
Copy link
Owner

tstack commented Apr 22, 2024

There's currently no command to focus on the breadcrumb bar, which is a gap. I think I'll add it as an option to the existing :prompt command, then folks can bind it to whatever they want. Thanks for letting me know about the issues.

tstack added a commit that referenced this issue Apr 22, 2024
@tstack
Copy link
Owner

tstack commented Apr 22, 2024

I've pushed a change that adds a breadcrumb option to the :prompt command. I've kept the backtick binding in the default keymap for now:

"x60": {
"id": "org.lnav.key.breadcrumb.focus",
"command": ":prompt breadcrumb"
},

I bound it to § in the sv keymap:

"xc2xa7": {
"id": "org.lnav.key.breadcrumb.focus",
"command": ":prompt breadcrumb"
}

I think a more appropriate and cross--language-keyboard friendly would be SHIFT + TAB because since TAB is used for file filtering which is Configuration panel

At the moment, Shift + TAB will also activate the configuration panel and it cycles forward/backward through the panels.

Note that in v0.12.2, you can also focus on the breadcrumbs using the mouse. That might help the situation a bit.

Do you folks actually use the breadcrumb bar? I'm amazed that anyone actually cared enough to notice/speak up. If so, that's great!

@metablaster
Copy link
Author

I've kept the backtick binding in the default keymap for now

That's fine with me, it's quake key on my keyboard which is easy to press.

Do you folks actually use the breadcrumb bar? I'm amazed that anyone actually cared enough to notice/speak up. If so, that's great!

Certainly, it's very useful to set time how fast to scroll, to select different log formats etc.

Overall no objections, but I'm new user so might me missing what ever gotchas.
I use lnav primarily to debug firewall and find it the best for the purpose and overall as well, and I've tried other programs as well but nowhere near as much functionalities as in lnav which I like the most.

@FaffeF
Copy link
Contributor

FaffeF commented Apr 22, 2024

I've pushed a change that adds a breadcrumb option to the :prompt command. I've kept the backtick binding in the default keymap for now:

Seems to work with the Swedish keymap, though now lnav exits on backtick, not sure if that was intended?
debug.txt

(10s to test, 15 min to figure out where to download the ci artifact... yeah, I'm a bit slow)

tstack added a commit that referenced this issue Apr 23, 2024
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