Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cleaning Strategy of journal Log in centos

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report