Previous session kernlogs

I am trying to debug a kernel crash in an openwrt router, but I can't seem to find dmesg/other logs from the previous session after boot. Since it is crashing without any crash dump/stack trace, looking at logs would be the next best thing.

How can I store previous session logs?

you can ship the logs someplace else in real time.

they're not kept between reboots.


syslog in OpenWrt is backed on a tiny ringbuffer in RAM, if you reboot, it's gone - if it's full, the oldest messages disappear. If you want meaningful debugging, you can setup remote logging to a syslog server in your LAN - or ideally connect a serial console.

1 Like

I got the UART console, but it misses a few messages during crash.

If the serial console won't catch it, barely anything else will (certainly not remote logging).

That is why previous session file would be helpful

There is none and there will never be any. Logging to flash in realtime, with fsync happening all the time, would be a sure way to destroy your flash within short time. Other than in a RPi, you can't just put in a new SDHC card every year, if the flash is worn out, the device is dead for good.