Fully understand RAMLog #1

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
ChristopheH
Posts: 2
Joined: Sun Mar 14, 2021 7:43 pm

Fully understand RAMLog #1

Post by ChristopheH »

Hello all,

I'm new in the DietPi community. I freshly installed DietPi on a Raspberry Pi Zero W and I have some questions related to RAMLog, option #1
The help pages regarding option #1 are saying :
+ Mounts /var/log to RAM
+ Increases overall system performance
+ Increases the life of your SD card by reducing filesystem IO (read/writes)
─ DietPi will automatically clear log files in /var/log every hour (to free memory)
─ Log files are NOT saved to disk
Question 1 : I added a test file "test_CH.log" in /var/log few hours ago and the file is not automatically deleted. I thought it should be the case one hour after... Do you know why ?

Question 2 : Using the script "dietpi-logclear" option 1 or 2 is correclty deleting my file "test_CH.log" but the others files inside /var/log remain unchanged. Here the files I mentioned :

Code: Select all

drwxr-xr-t  4 root root  180 Mar 14 19:52 .
drwxr-xr-x 12 root root 4096 Feb 20 11:49 ..
-rw-r--r--  1 root root    0 Feb 21 17:44 alternatives.log
drwxr-xr-x  2 root root  100 Mar 12 14:57 apt
-rw-rw----  1 root utmp    0 Mar 14 10:17 btmp
-rw-r--r--  1 root root    0 Mar 12 16:17 dpkg.log
-rw-rw-r--  1 root utmp    0 Mar 14 10:17 lastlog
drwx------  2 root root   40 Jan 18 17:28 private
-rw-rw-r--  1 root utmp    0 Mar 14 10:17 wtmp
Is it normal that these files are not affected by the script ?

Question 3 : journalctl command is used to display log. Is it normal to find log dated from more that one hour?
This command is giving me boot log from Feb 14, the first time I installed DietPi on my Rpi (but these logs are nerver deleted even after reboot, power off and on...etc.) and just after that it switches on log starting from the last reboot to now. I thought again that only one hour of log should be present... Is it normal ?

Question 4 : last question, related to the previous one. Where I can find the log files used by journalctl ? I thought about the files mentioned in question 2 but this is not the case.

Thank you for your answers.

Regards.
User avatar
Joulinar
Posts: 5115
Joined: Sat Nov 16, 2019 12:49 am

Re: Fully understand RAMLog #1

Post by Joulinar »

Hi,

files did not get deleted, they will just be emptied (set to 0) and contend get copied to a permanent storage. As you can see on your output, there are quite some files with 0 space usage

Code: Select all

-rw-r--r--  1 root root    0 Feb 21 17:44 alternatives.log
drwxr-xr-x  2 root root  100 Mar 12 14:57 apt
-rw-rw----  1 root utmp    0 Mar 14 10:17 btmp
-rw-r--r--  1 root root    0 Mar 12 16:17 dpkg.log
-rw-rw-r--  1 root utmp    0 Mar 14 10:17 lastlog
drwx------  2 root root   40 Jan 18 17:28 private
-rw-rw-r--  1 root utmp    0 Mar 14 10:17 wtmp
yes it is normal to see all logs on journalctl as long as the system did not reboot. Log is stored at /run/log/journal/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3097
Joined: Sat Nov 18, 2017 6:21 pm

Re: Fully understand RAMLog #1

Post by MichaIng »

Since /run is an own tmpfs/RAMdisk, the systemd journal always logs to RAM by default and is not part of /var/log plain text files that are affected by DietPi-RAMlog.

Btw you can control also the systemd journal lifetime and max size and such via /etc/systemd/journald.conf.
Post Reply