Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5091

Raspberry Pi OS • Re: How do I disable all logging in rpi os 64bit (Bookworm)?

$
0
0
After searching more this is what I did. I am posting this if anyone needs this.

sudo systemctl stop rsyslog and sudo systemctl disable rsyslog don't work anymore. Rsyslog is deprecated in new OS. Now it uses systemd journaled https://raspberrypi.stackexchange.com/a/109429/166605. Now check if

/var/log/journal and
/run/log/journal exist. If then run

Code:

du -sh /var/log/journa
l and

Code:

du -sh /run/log/journal
Now modify this to your liking

Code:

sudo nano /etc/systemd/journald.conf 
and

Storage=volatile
RuntimeMaxUse=64M


If you want to keep some logs,. For my case, it is just https://forum.zorin.com/t/quieting-driv ... ty/30313/2

Storage=none

Now it's time for logrotate to be modified. Check logrotate timer

Code:

systemctl status logrotate.timer
Then change it to your liking.

sudo nano /etc/logrotate.conf to modify .

For me, it is:

# create new (empty) log files after rotating old ones
nocreate

# system-specific logs may also be configured here.
nocreateolddir


Now need to force logrotate

Code:

sudo logrotate -vf /etc/logrotate.conf

Now again, run this to see if any changes happen.

Code:

du -sh /var/log/journal anddu -sh /run/log/journaljournalctl --disk-usage
If not, then https://unix.stackexchange.com/a/620432

Code:

sudo systemctl restart systemd-journaldsudo journalctl --vacuum-size=10Msudo journalctl --vacuum-time=10min

If you have followed the steps to set Storage=volatile and systemd-journald logs are still being written to disk, there might be a few reasons for this. Here are some additional steps to ensure logs are not stored on disk.
Check for any runtime directory logs and ensure that no runtime directory logs are being stored:

Code:

sudo ls /run/log/journal
Check for any persistent directory logs and verify if any persistent logs exist in the following directory:

Code:

sudo ls /var/log/journal
If this directory exists and contains logs, you can safely delete its contents:

Code:

sudo rm -rf /var/log/journa
l

Verify the status of systemd-journald to ensure the configuration has been applied:

Code:

sudo systemctl status systemd-journald

Ensure other logging services are not writing to disk:
Other logging services (e.g., rsyslog or syslog-ng) might still be writing logs to disk. Check if these services are running:

Code:

sudo systemctl status rsyslog sudo systemctl status syslog-ng
If they are running and you want to disable them:

sudo systemctl stop rsyslog

Code:

sudo systemctl disable rsyslog sudo systemctl stop syslog-ng sudo systemctl disable syslog-ng
Restart the system:

Code:

sudo reboot
Ensure there are no syntax errors in the journald configuration file:

Code:

sudo systemd-analyze verify /etc/systemd/journald.conf
After this [ code] journalctl --disk-usage[/code] returned 0MB.

Statistics: Posted by sohojmanush — Sat Aug 03, 2024 1:07 pm



Viewing all articles
Browse latest Browse all 5091

Trending Articles