Last active
May 27, 2019 14:20
-
-
Save sudipidus/3832457df13a0b79a359b43fc63386fd to your computer and use it in GitHub Desktop.
This script is to filter out the most recurring log messages. I faced an issue where syslog was rapidly increasing (35 GB) in a single day. I have /var/log mounted on root partition and this space usage was causing issue. Courtesy: https://askubuntu.com/a/515152/309358
This file contains hidden or 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
for log in /var/log/{dmesg,syslog,kern.log}; do | |
echo "${log} :" | |
sed -e 's/\[[^]]\+\]//' -e 's/.*[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}//' ${log} \ | |
| sort | uniq -c | sort -hr | head -10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment