1

I often reboot a development box and then have to sift through syslog.

How can I add a marker beetween the last line before shutdown and the first line of the new boot?

Box is Debian stable with rsyslog 8.4.2-1+deb8u2

1

If the only point is to find the start of a new boot, you can just look for this regular expression in the logging output

 kernel: \[ *0.000000] Linux version
1

The logger program is a command line interface to the logging system, so just run something like

logger -p kernel.notice "---------- Rebooting ---------"

before you reboot. There are lots more options.

  • Where would I add this? I don't want to enter this manually each time I reboot... – Jan Dec 26 '16 at 22:38
  • Depends on how you reboot! If you are entering a reboot command then just create a 2 line script that does the logger and calls the original program. If you are using something like ctrl-alt-del to do it then perhaps tldp.org/HOWTO/Remote-Serial-Console-HOWTO/… will help you? – icarus Dec 26 '16 at 22:45
  • Hmm, maybe this is correct, but isn't there a central place where I can configure this? – Jan Dec 26 '16 at 22:52
  • 1
    In general no. Part of the problem is deciding exactly where you need to put this call. You probably still want networking enabled in case you have rsyslog configured to do remote logging. If you only wanted to find out when the machine rebooted you could look for something like kernel: \[ *0\.000000] Linux version – icarus Dec 26 '16 at 23:42
  • OMG, not possible didn't think of that - that's the answer... please add it so I can accept it. – Jan Dec 26 '16 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.