You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[oxlog] sort log files before printing them out (#5356)
Found this while attempting to debug core files during today's mupdate -- I was
confused about logs getting skipped for a bit. We should sort log files so
they're printed in ascending order, disregarding the directories they're from.
Sort by filename only, because log files can go in. Sorting by file name
sorts by (service name, timestamp), which is the order we want 99% of the
time.
There is one wrinkle here, which is that for log files that are written
before NTP sync, the timestamps are of the form:
```
/pool/ext/f522118c-5dcd-4116-8044-07f0cceec52e/crypt/debug/oxz_switch/oxide-wicketd:default.log.536112897
```
But for log files written after NTP sync, they're of the form:
```
/pool/ext/f522118c-5dcd-4116-8044-07f0cceec52e/crypt/debug/oxz_switch/oxide-wicketd:default.log.1699421382
```
The latter gets sorted before the former, which isn't ideal. But also it
works fine and achieves the goal of keeping related logs together.
(Note that sorting by file name is possible with `sort` but a bit hard. Something like `sort -t/ -k7` would work: the `7` here indicates the depth at which log files are found.)
0 commit comments