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

oxlog: want a way to list N most recent log files #6946

Open
hawkw opened this issue Oct 29, 2024 · 1 comment
Open

oxlog: want a way to list N most recent log files #6946

hawkw opened this issue Oct 29, 2024 · 1 comment
Labels
Debugging For when you want better data in debugging an issue (log messages, post mortem debugging, and more) development Bugs, paper cuts, feature requests, or other thoughts on making omicron development better

Comments

@hawkw
Copy link
Member

hawkw commented Oct 29, 2024

When debugging, log rotation may have occurred at some point during the event of interest. In that case, it's often useful to be able to inspect the current log file for a service plus the archived log file immediately prior to the current one. Doing this with oxlog is presently somewhat difficult, because archived log files may exist across multiple datasets, and piping oxlog into sort(1) will not output the log files in chronological order, since they are sorted by the UUID of the dataset before sorting chronologically. This is unfortunate.

It would be nice if oxlog logs --archived had a way to select the N most recent archived logs. That way, a user who wishes to use grep or looker to search for an event in the current and most-recent-archived log files could run something like:

$ oxlog logs <SVC> --current --last 1 | xargs -L 1 cat | looker

or whatever.

@hawkw hawkw added Debugging For when you want better data in debugging an issue (log messages, post mortem debugging, and more) development Bugs, paper cuts, feature requests, or other thoughts on making omicron development better labels Oct 29, 2024
@leftwo
Copy link
Contributor

leftwo commented Oct 29, 2024

I've also had luck with sort like this:

/opt/oxide/oxlog/oxlog logs --archived oxz_nexus_65a11c18-7f59-41ac-b9e7-680627f996e7 nexus | sort -t. -k3,3 | tail -n2

That usually gives me the two most recent archived log files, but it relies on the log file path structure being consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debugging For when you want better data in debugging an issue (log messages, post mortem debugging, and more) development Bugs, paper cuts, feature requests, or other thoughts on making omicron development better
Projects
None yet
Development

No branches or pull requests

2 participants