Monitoring the logs after crash

HASSIO has been crashing every several days for me. The only way for me to get it back up is to restart the system. When that happens though HASSIO resets the logs.

Any suggestions on how to keep the logs even after a reboot? I believe this is a known issue.

1 Like

It does seem strange to wipe the logs from the SD card on reboot, if they get wiped then storing them RAM would be better IMO.

As a solution I can only suggest backing up the logs once per hour, with an automation maybe?

What do you think the best way would be to do this? Write a script? I don’t see a native way to copy a file with HASSIO.


Does anyone have a script to do this? I’m having the same issue. My HA crashes every several days and I can’t find the issue source.

Yes, I used the one tom_l mentioned, but I needed to alter it a bit to get it to work. This one works for me:


  fire_event: true
  - name: persistent_log
    platform: file
    filename: persistent.log ### will be in /config


- id: my_system_log
  alias: My Persistent Error Log
  initial_state: true
    - platform: event
      event_type: system_log_event
        level: WARNING
    - platform: event
      event_type: system_log_event
        level: ERROR
    service: notify.persistent_log
      message: '{{ now().strftime("%H:%M %Y-%m-%d") }} {{ }} [{{ }}] {{[0] }} {{ }}'

Unfortunately my Pi crashes almost everyday and it did last night after I had this script running, but it did not catch any errors or warning prior to crashing :frowning:

Just a tip, when you see weird crashed and reboots without any error logs on a Pi. Check/Replace your USB-Power cable and maybe even charger. My cable was working fine mostly but apparently sometimes HA would just draw a bit too much power. It was driving me crazy, after replacing my cable everything is smooth now :slight_smile:

I know it’s been a while since your post but maybe you still have this problem or it might help someone else