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

How to set a permanant time_offset? #732

Open
pnoeric opened this issue May 26, 2020 · 6 comments
Open

How to set a permanant time_offset? #732

pnoeric opened this issue May 26, 2020 · 6 comments

Comments

@pnoeric
Copy link

pnoeric commented May 26, 2020

I know I can set the time_offset every time I run lnav, but that's a hassle.

I tried updating the setting in the SQL lnav_file but that also doesn't appear to persist across sessions.

I checked the docs but couldn't find any more clues. What's the secret? ;-) Can I have lnav permanently remember this setting? Or at least pass it on the command line?

@pnoeric
Copy link
Author

pnoeric commented Jun 10, 2020

No luck eh?

@tstack
Copy link
Owner

tstack commented Jun 10, 2020

What version of lnav are you using? The offset is supposed to be saved in the session, so it might be a bug if that is not happening. Can you provide an lnav debug log (pass -d /path/to/log on the command-line) to help me figure out what might be happening.

Can I ask what are you using the time_offset for? Are you trying to adjust for the timezone or small differences in logs between different machines?

@pnoeric
Copy link
Author

pnoeric commented Jun 10, 2020

Hey Tim, thank you for this reply... I'll be happy to share that info but let me ask, when I press ctrl-R to reset lnav, does that also reset the time offset? Because I use ctrl-R all the time. ;-) So maybe that's the issue with it not persisting.

I'm using it only because my server is in GMT (and I don't want to change that), but I don't live in GMT and I would like to see the logged events in my own time zone, that's all.

@tstack
Copy link
Owner

tstack commented Jun 10, 2020

when I press ctrl-R to reset lnav, does that also reset the time offset? Because I use ctrl-R all the time. ;-)

Yeah, CTRL-R does clear the time offset (ref:

lf->clear_time_offset();
).

I'm using it only because my server is in GMT (and I don't want to change that), but I don't live in GMT and I would like to see the logged events in my own time zone, that's all.

A log format can be set to convert timestamps to local time when it's known that the timestamps are always UTC. But, that doesn't really work for cases like this... seems like something that should be added to lnav.

@pnoeric
Copy link
Author

pnoeric commented Jun 10, 2020

Ah ok. I could adjust my log format (I see you have excellent docs for that)... but yeah, I look at a few different log formats so I'd have to change several formatters and override your defaults that already work perfectly.

So yeah, maybe a global time-offset option, unaffected by ctrl-R, is the right answer. I hope I am not creating work for you! hehe

@ian-h-chamberlain
Copy link

Hey, I guess this is kind of an old issue, but I found it looking for kind of the opposite thing — is there some way I can reset the time offset without ctrl-R ? I sometimes just want to undo my timestamp changes and I don't remember exactly what the original times were, but I'd like to keep my bookmarks, filters etc.

FWIW, in my experience the time offset does survive restarts of a session, and I haven't been able to reset it in one case even with ctrl-R due to lnav crashing — which I should try to get a minimal repro of and open a new issue.

Anyway, I guess I wanted to see if there's some way to reset just the time offset, and if not I can file a new issue to request it (or to document it, if there is already a way to do it).

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

No branches or pull requests

3 participants