-
Notifications
You must be signed in to change notification settings - Fork 59
Capture log file mtimes in support bundles #9222
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
base: main
Are you sure you want to change the base?
Conversation
44b389f to
c202a87
Compare
Currently the mtime for log files captured in support bundles is always set as the default value of 1980-01-01T00:00. To more easily sort files by time, it would be convenient to capture their actual mtimes in the bundle zip. Attempt to get the mtime for logs captured by `sled-diagnostics`, falling back on the default if this fails, and copy the mtime into the final bundle zip in nexus.
c202a87 to
dc4d978
Compare
|
I think this is good information to pass along in the zip file, however I believe we already have access to the mtime from oxlog, if you look at |
Great point, I've updated to use the cached mtime when available. |
Oxlog is already collecting the file mtime for us when it find the logs. Avoid `stat`ing the files a second time and pass the cached time to the zip archive.
0d56d0c to
80681cb
Compare
| if file_type.is_file() { | ||
| let src = entry.path(); | ||
|
|
||
| let system_mtime = entry.metadata().and_then(|m| m.modified())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions about this...
Should we ignore errors here so that we still include files that we fail to read an mtime from and continue collecting the bundle?
Since we are getting the logs in a zip file and then unpacking them on a sled where a bundle is being collected are we sure that the unzip process is preserving original modification times? I believe it does hence the entire point of this PR haha but it would be good to maybe test that the zip crate is doing this.
| { | ||
| let logfile = f.path(); | ||
| let system_mtime = | ||
| f.metadata().and_then(|m| m.modified()).inspect_err(|e| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata() here doesn't follow symlinks...which I believe is okay since we are operating from the gz context.
Currently the mtime for log files captured in support bundles is always set as the default value of 1980-01-01T00:00. To more easily sort files by time, it would be convenient to capture their actual mtimes in the bundle zip.
Attempt to get the mtime for logs captured by
sled-diagnostics, falling back on the default if this fails, and copy the mtime into the final bundle zip in nexus.