Created
June 20, 2022 06:00
-
-
Save luckylittle/568edac6a58f0730f148fd41210237f6 to your computer and use it in GitHub Desktop.
Quickly empty all the major logs on RHEL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
LOGS=( | |
/var/log/boot.log | |
/var/log/btmp | |
/var/log/cron | |
/var/log/dnf.librepo.log | |
/var/log/dnf.log | |
/var/log/dnf.rpm.log | |
/var/log/firewalld | |
/var/log/hawkey.log | |
/var/log/lastlog | |
/var/log/maillog | |
/var/log/messages | |
/var/log/secure | |
/var/log/spooler | |
/var/log/vbox-setup.log | |
/var/log/wtmp | |
/var/log/anaconda/anaconda.log | |
/var/log/anaconda/dbus.log | |
/var/log/anaconda/dnf.librepo.log | |
/var/log/anaconda/hawkey.log | |
/var/log/anaconda/journal.log | |
/var/log/anaconda/lvm.log | |
/var/log/anaconda/packaging.log | |
/var/log/anaconda/program.log | |
/var/log/anaconda/storage.log | |
/var/log/anaconda/syslog | |
/var/log/anaconda/X.log | |
/var/log/audit/audit.log | |
/var/log/citrix/ICAClient.log | |
/var/log/cups/access_log | |
/var/log/cups/error_log | |
/var/log/cups/page_log | |
/var/log/rhsm/productid.log | |
/var/log/rhsm/rhsmcertd.log | |
/var/log/rhsm/rhsm.log | |
/var/log/sssd/sssd_implicit_files.log | |
/var/log/sssd/sssd_kcm.log | |
/var/log/sssd/sssd.log | |
/var/log/sssd/sssd_nss.log | |
/var/log/tuned/tuned.log | |
) | |
for LOG in ${LOGS} | |
do | |
cat /dev/null | sudo tee ${LOG} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment