It seems obvious that reboot messages should be printed at the end rather than buried in hundreds of lines of output.
Since they aren't, here is an alias command that watches for "reboot" and if it finds it, prints a message at the end:
Or, more simply:
# script -c 'apt-get update' /tmp/update.log
# script -c 'apt-get dist-upgrade' /tmp/upgrade.log
Now, you have usable log files for both commands - that you can grep or whatever you like to your heart's content.
Notes:
1) There are fancier tools than
script that I could (and would) have used, but I wanted to keep it simple for presentation purposes.
script is basic Unix - doesn't have to be installed or anything.
2) Any solution (such as the alias posted above) that involves things like piping and
tee will fall apart if the thing goes interactive - i.e., if it stops to ask questions.
script,
luckily by design, handles this just fine. Yes, I know that you specified "-y", which should make it non-interactive, but, as has been discussed here at length and is now well-established, using "-y" does not totally prevent interactivity. The upgrade process can still pause and ask questions - and these questions need to be answered by a live, thinking human being; they cannot, in general, be sensibly automated away (even though they have tried - with that "unattended upgrade" thing).