Log before crash

Hi,

My home assistant is installed on a Odroid N2+ (Home assistant OS).

I would like to have a copy of the log file each times home assistant restarts. This way, when HA crashes I still have the last log.

How can I do that ? Running last version of HA.

If You have Terminal Installed The “rotated” logs are to be found in “/var/log/journal”
Thou not in “clear-txt”
If HA Crashes ( so the txt-log-file is “renewed/corrupt/gone” )( Sometimes, it’s not like there is anything to “copy” ( I.e the milli-seconds before it crashes )

HA previously had a txt-logfile in /config , But Now this works Different !

Goto. /Setting/system/logs , Click to the Right on the 3 Dots (RAW-Log), … scroll until you get tired :wink: … Or copy/download it to your PC/Laptop
It’s reading from the Journal-Files !

Thanks for that !

1 Like

@Tsar you can restore the old logfile functionality by following this if you’re not concerned about space.
Easier to read & to distinguish which logs belong to the previous session before the restart.

2 Likes

Is this a one time step or has to be done after every HA update again?

Yep, one time deal. No need to reapply it after updates.

2 Likes

Ah. Ok. Thought about because of the rebuild step.

BTW. Here it is already restarting in this step two automatically

ha core options --duplicate-log-file=true
ha core rebuild
ha core restart

Tbh I didn’t check if it restarted by itself on step 2. I guess an extra restart won’t hurt. At the very least you’ll see the old log (log.1) working