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

Missing show/hide-fields command in :save-session-to #1352

Open
ConorMurphy21 opened this issue Dec 3, 2024 · 4 comments
Open

Missing show/hide-fields command in :save-session-to #1352

ConorMurphy21 opened this issue Dec 3, 2024 · 4 comments
Labels

Comments

@ConorMurphy21
Copy link

lnav version
I believe latest

Describe the bug
:save-session writes a list of commands, including :show-fields and hide-fields to a json file in the lnav home directory. But when calling :save-session-to which produces an lnav file, these commands are not added to the output session file.

To Reproduce

  1. run :hide-fields body command
  2. run :save-session-to /tmp/sesh.lnav
  3. Observer no :hide-fields body in the /tmp/sesh.lnav
@tstack
Copy link
Owner

tstack commented Jan 15, 2025

Hmm, I kinda want to say this was intentional. The :export-session-to command is more for sharing a session with another user. And, that user might not have the same preferences for the set of fields that are hidden/shown.

@ConorMurphy21
Copy link
Author

Ok, I'm fine to close this if that's the intent, working around it isn't a big deal. Just to understand the use case though, I've been using the export-session-to command to look at similar log files with the same filters and stuff. For example testRun1/testLog and testRun2/testLog, where the content of the file should be very similar but it's useful to have to same filters to analyse the differences between a passing run log file vs a failing run log file.

@tstack
Copy link
Owner

tstack commented Jan 30, 2025

look at similar log files with the same filters and stuff

Maybe take a look at #949 which has some discussion on setting up filters.

How about this, I could add the :hide-fields commands to the exported session script, but have them commented out by default. That way, it's easy to figure out the command.

Another option is to patch the format you're interested in to always have the fields hidden. For example, to patch syslog_log to hide the log_hostname field by default, you could use this patch file:

{
  "syslog_log": {
    "value": {
      "log_hostname": {
        "hidden": true
      }
    }
  }
}

@ConorMurphy21
Copy link
Author

I think the commented out idea is a great idea! (and/or making it an optional parameter from the CLI)

I am aware of how scriptable LNAV is, I've written many scripts now to tune it to my liking. I've been super happy with it, awesome work! To get around this issue I've been relying on the fact the save-session command has this filter information included in the json. So I was just hoping to make my scripts feel a little less hacky, and also use tmp files so I don't fill up .config/lnav.

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

No branches or pull requests

2 participants