Find out why HA died in the night

On a number of occasions in recent weeks, Home Assistant has died / crashed. This seems to be randomly - but more often than not it’s overnight. That means I don’t get my morning alarm, and a number of things that should run overnight, don’t.

I thought it might be a dying SD card (2+ years old) so I replaced it and restored a backup. The issue persists.

When I check the logs it only ever shows me everything after the hard reboot.

Is there anyway to find out why this is happening if the logs don’t show me everything before the reboot?

Depending on the version of HA you are running as you didn’t mention it you should have 2 log files. the second being home-assistant.log.1 - this is the log file before you rebooted.

Thanks. Sorry, I’m on the latest version.

I’ve found the log in File Editor. Nothing really jumps out at me. If I share it here, is there any private data I should remove first?