Logs not being persisted hourly with DietPi-Ramlog #2

Hello all,

I have setup logging system to: “DietPi-Ramlog #2 : Hourly save, then clear.” and this option has kept the logs in RAMdisk for an hour and then appended logs hourly to /root/logfile_storage in the past. But today I witnessed that the hourly appending has stopped and that the log file is just kept at /var/log/my_custom_logfile.log. I diff-ed files at /root/logfile_storage to see if logs are getting hourly appended but there has been no change at all. The log files at RAMdisk at /var/log/* keep getting larger. I rechecked that logging system is still set to “DietPi-Ramlog #2 : Hourly save, then clear.” and even switch to “DietPi-Ramlog #1” and back to #2, but that didn’t fix my issue.

Can someone help why is the hourly persistence/appending logs not working as intended.

Hi,

many thanks for your request. I tried to replicate your issue, but without success. I created a dummy.log file and after a hour it was successfully transferred and shrieked. So in general the process is working fine.

root@DietPi3:~# cd /var/log/
root@DietPi3:/var/log# ls -l
total 8
-rw-rw---- 1 root utmp   0 May 31 14:21 btmp
-rw-r--r-- 1 root root   0 May 31 18:17 dummy.log
-rw-rw-r-- 1 root utmp 292 May 31 21:47 lastlog
drwx------ 2 root root  40 May 31 02:17 private
-rw-rw-r-- 1 root utmp 384 May 31 21:47 wtmp
root@DietPi3:/var/log# cd /root/logfile_storage
root@DietPi3:~/logfile_storage# ls -la
total 24
drwxr-xr-x 2 root root 4096 May 31 18:17 .
drwx------ 6 root root 4096 May 31 00:17 ..
-rw-r--r-- 1 root root   20 May 31 18:17 dummy.log
-rw-r--r-- 1 root root 1168 May 31 18:17 lastlog
-rw-r--r-- 1 root root 7680 May 31 18:17 wtmp
root@DietPi3:~/logfile_storage#

Thanks for taking the time to respond.

This is what I am confused about as well. This functionality was working fine for me as well some time back but it has stopped functioning for me now. Is there a way I can pull logs on how logs are rotated? Can you share the script which is runs hourly to move logs from RAMDisk to persistent storage?

Hi,

best to my knowledge there is not log from the script itself. The following script is used to move logs to backup location /boot/dietpi/func/dietpi-logclear

As well you could have it executed manually using following options

        #////////////////////////////////////
        # Info:
        # - Location: /boot/dietpi/func/dietpi-logclear
        # - Clears logs in $FP_LOG, with backup option.
        #
        # usage:
        # - dietpi-logclear 0           | Update current log files data to "$FP_BACKUP/*. Then clear contents.
        # - dietpi-logclear 1           | Clear contents of all logs in $FP_LOG.
        # - dietpi-logclear 2           | Delete all logs in $FP_LOG and backups.
        #////////////////////////////////////

The script themselves is triggered by /etc/cron.hourly/dietpi and it depends on correct setting in /boot/dietpi/.installed. In your case it should looks like this:

# DietPi Choice System: Logging
INDEX_LOGGING_CURRENT=-2
INDEX_LOGGING_TARGET=-2