Get the App
SLTechnology News&Howtos  ›  Servers  › 

Cleaning Strategy of journal Log in centos

Shulou Source: shulou.com Published: 2022-06-01 10:16:06 10月04日 Update

This article mainly explains "the cleaning strategy of journal logs in centos". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn the "cleaning strategy of journal logs in centos"!

Systemd, which started in CentOS 7, uses journal logs, which are managed differently from syslog in the past and can be maintained through administrative tools.

Use df -h to check the disk file. You can see that there is a log directory/run/log/journal under the/run directory, which takes up several G space.

Filesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 8.5G 4.2G 4.4G 49% /tmpfs 16G 1.6G 15G 11% /run

There are many historical accumulated logs in the log directory.

Check the current journal disk usage

journalctl --disk-usage

Cleaning methods can be used to clean up by date or by allowed capacity

journalctl --vacuum-time=2djournalctl --vacuum-size=500M

If you want to delete log files manually, you need to rotate journal logs once before deleting them

systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service

To enable log restriction persistence configuration, modify/etc/systemd/journald.conf

SystemMaxUse=16MForwardToSyslog=no

then restart

systemctl restart systemd-journald.service

Check whether journal is running properly and whether the log file is intact and uncorrupted

journalctl --verify At this point, I believe everyone has a deeper understanding of the "journal log cleaning strategy in centos", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Logs policies files directories checks content methods methods disks learning management different practical deeper interest history can be passed practical practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Technology Docker NVidia Xiaomi