Which log to look at after a crash? (DietPi-RAMlog #2 enabled)

My dietpi crashed in the middle of the night, because of the way I have pi-hole configured it means if the diet pi dies I lose internet connection. It’s not the first time it’s happened so I wanted to see if there were any useful logs, I’ve now enabled DietPi-RAMlog #2 so if I’m lucky I might have some info to go on if it crashes again.

Now I can see in root a directory logfile_storage with a the following files

  • alternatives.log
  • lastlog
  • lighttpd
  • php7.4-fpm.log
  • pihole-FTL.log
  • pihole.log
  • proftpd
  • radarr
  • sonarr
  • wtmp

the next time I get a crash which log would be best to look at? If I look in last log it’s just a line of @^

persistent system logs could be enabled as follows

dietpi-software uninstall 103 # uninstalls DIetPi-RAMlog
mkdir /var/log/journal # triggers systemd-journald logs to disk
reboot # required to finalise the RAMlog uninstall

Then you can check system logs via:

journalctl

which will then show as well logs from previous boot sessions. To limit the size, you can additionally e.g. apply the following:

mkdir -p /etc/systemd/journald.conf.d
cat << '_EOF_' > /etc/systemd/journald.conf.d/99-custom.conf
[Journal]
SystemMaxFiles=2
MaxFileSec=7day
_EOF_

This will limit logs to 14 days split across two journal files, so that with rotation you will always have between 7 and 14 days of logs available.

Thanks, if I do that will I be putting more stress on the micro SD by writing to it more often?

should be not that much. Aim is to preserve logs from being lost on reboot.

I did this, and it worked, but I did not understand, why this was necessary. I thought this is the aim of RAMlog #2 option?? Maybe I am missing the point.

BTW, with enabling RAMlog #2 I did not see any directory

/logfile_storage 

So I came around here, the solution works fantastic, this is pretty much what I wanted to have. If I understand correctly , I have now a journalctl with a full systemlog and I save my sd card, right?

should be located on /var/tmp/dietpi/logs/dietpi-ramlog_store

Well, at least for everything that logs into journald

1 Like