Log files wiped after reboot

Log files wiped after spontaneous reboot.
After running for nearly 2 weeks, my MK2 decided to do a reboot.
I just suddenly heard the “Neon AI is ready” spoken.
Afaik there was no power outage, the house is on a hybrid solar inverter with batteries. None of the other electronics in the house is showing any evidence of power trouble.
I wanted to see what/when the last logged command was in ~neon/logs.
When a system is upgraded, the log files are moved into a dated sub dir.
It turns out that after a reboot that wasn’t done “nice” all the data is lost.

during upgrade/shutdown write a “clean shutdown” flag on the file system.
During bootup, check for that flag, if it is not there AND there are log files, make a dated subdir and move the logfiles in there before starting neon.