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

Prepend timestamps option -t is no longer supported in v0.12.0-beta1 #1236

Closed
lamchau opened this issue Feb 21, 2024 · 8 comments
Closed

Prepend timestamps option -t is no longer supported in v0.12.0-beta1 #1236

lamchau opened this issue Feb 21, 2024 · 8 comments
Labels

Comments

@lamchau
Copy link

lamchau commented Feb 21, 2024

lnav version

lnav 0.12.0-beta1-24-gc68b7ec

Describe the bug

In v0.11.2, we were able to use lnav -t to prepend timestamps to logs but in HEAD (c68b7ec) this option no longer works.

OPTIONS
    -t        Prepend timestamps to the lines of data being read in on the standard input.

Error

✘ error: invalid command-line arguments
 reason: The following argument was not expected: -t

To Reproduce

Steps to reproduce the behavior:

  • make 2>&1 | lnav -t is no longer supported
@lamchau lamchau added the bug label Feb 21, 2024
@tstack
Copy link
Owner

tstack commented Feb 21, 2024

The time is always recorded for every line piped into lnav now. It’s stored in the file of captured output. In the TEXT view you can see the timestamp for the current line in the breadcrumb bar and you can press shift+t to show the time differences between lines. I felt that covered the functionality of the -t flag, so I removed it.

@lamchau
Copy link
Author

lamchau commented Feb 21, 2024

ahh, thank you for the fast response! In v0.12 I can't seem to get the ISO format like we had in v0.11 - am I missing something?

v0.12

image

v0.11

image

@tstack
Copy link
Owner

tstack commented Feb 21, 2024

Basically, I removed the functionality. Although, it looks like I should add it back, but in a different form...

I wasn't sure how often -t was used and I didn't like that people had to think ahead and remember to set the flag. I was also adding other functionality to run commands within lnav. So, I changed things around so that the timestamp was always recorded.

The main use I had for it was the time difference stuff and I didn't need the actual timestamps. But, it looks like the program you're piping into lnav is generating real log messages that you might want to merge with other log files. I'll see about adding a way to run a command to convert the text file to a log file (or maybe restore the -t flag to do that conversion).

@lamchau
Copy link
Author

lamchau commented Feb 21, 2024

Yeah I'm not sure how many people use it but it's often something I show to my colleagues over the years and becomes their daily driver.

For now my workaround is to use a separate build but has the side effect of the timestamp parsing fix introduced sometime in v0.12.

Appreciate the work and fast responses! Thanks so much!

@tstack
Copy link
Owner

tstack commented Feb 22, 2024

I've pushed a change to restore the -t flag, if you want to update and give it a try. I still need to add a separate command to convert a text file to a log.

Thanks for taking the time to file this bug.

@lamchau
Copy link
Author

lamchau commented Feb 22, 2024

Thanks for adding this non-trivial fix in so quickly! Hopefully it wasn't too distracting from other features.

Just updated to and works like a charm! 🙏

@tstack tstack closed this as completed Mar 21, 2024
@piotr-dobrogost
Copy link

The time is always recorded for every line piped into lnav now.

Out of curiosity – is the above no longer the case?
Wouldn't automatically recording time and using it as a timestamp if there's no timestamp detected in the input work?

@tstack
Copy link
Owner

tstack commented Mar 25, 2024

The time is always recorded for every line piped into lnav now.
Out of curiosity – is the above no longer the case?

This is still true.

Wouldn't automatically recording time and using it as a timestamp if there's no timestamp detected in the input work?

Yes, this is what happens when -t is used now.

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

3 participants