Today I notice that this blog’s disk usage is exceeding 50%.
So a maintenance is in order. One of the area that I can clean of is the logs. To check how much disk usage consumed by logs:
du -h /var/log
We can see which one consume the most:
104K /var/log/apt 80K /var/log/letsencrypt 4.0K /var/log/apache2 32K /var/log/mysql 80K /var/log/unattended-upgrades 44K /var/log/exim4 4.0K /var/log/samba 8.0K /var/log/openvpn 1.1G /var/log/journal/78571dd6ca7745fd883930edfbc1aec0 1.1G /var/log/journal 880K /var/log/nginx 1.2G /var/log
So the main culprit is /var/log/journal. But is it safe to remove the journal’s log? According to THIS, it’s perfectly safe.
With that in mind, let’s empty it out. But before deleting anything, let’s check the content:
ls /var/log/journal/78571dd6ca7745fd883930edfbc1aec0/
Looks like a number of journal files:
system.journal system@e09f493f5d9543ccac3a01a18a5a7966-0000000000000001-0005c912944622d1.journal system@e09f493f5d9543ccac3a01a18a5a7966-0000000000027cda-0005c9db59ac33c2.journal system@e09f493f5d9543ccac3a01a18a5a7966-000000000004f9c8-0005ca3f9fdef072.journal system@e09f493f5d9543ccac3a01a18a5a7966-0000000000078054-0005ca79a740fa97.journal system@e09f493f5d9543ccac3a01a18a5a7966-00000000000a1c80-0005cb04b06080bc.journal system@e09f493f5d9543ccac3a01a18a5a7966-00000000000ce097-0005cb2b4509171f.journal system@e09f493f5d9543ccac3a01a18a5a7966-00000000000f8e58-0005cbabe81428d7.journal system@e09f493f5d9543ccac3a01a18a5a7966-0000000000124d00-0005cbdc50807f36.journal user-1000.journal
Let’s remove them all:
rm /var/log/journal/78571dd6ca7745fd883930edfbc1aec0/*.journal
Now verify the disk usage after:
du -h /var/log
It’s much less now:
104K /var/log/apt 80K /var/log/letsencrypt 4.0K /var/log/apache2 32K /var/log/mysql 80K /var/log/unattended-upgrades 44K /var/log/exim4 4.0K /var/log/samba 8.0K /var/log/openvpn 4.0K /var/log/journal/78571dd6ca7745fd883930edfbc1aec0 8.0K /var/log/journal 884K /var/log/nginx 62M /var/log
Looks like we can clean further /var/log. Let’s find the offending files:
ls -l -S /var/log
And the culprits are:
-rw-rw---- 1 root utmp 18732672 Aug 31 02:22 btmp.1 -rw-rw---- 1 root utmp 16121472 Sep 30 01:23 btmp -rw-r----- 1 syslog adm 10247924 Sep 26 02:19 mail.log.1 -rw-r----- 1 syslog adm 9098913 Sep 27 02:20 auth.log.1 -rw-r----- 1 syslog adm 2289106 Sep 30 09:19 mail.log -rw-r----- 1 syslog adm 1152534 Sep 13 02:20 auth.log.3.gz -rw-r----- 1 syslog adm 1069630 Sep 30 09:19 auth.log -rw-r----- 1 syslog adm 972616 Sep 6 02:13 mail.log.4.gz -rw-r----- 1 syslog adm 744907 Sep 30 02:20 syslog.1 -rw-r----- 1 syslog adm 659046 Sep 12 02:20 mail.log.3.gz -rw-r----- 1 syslog adm 518091 Sep 5 02:20 auth.log.4.gz -rw-r----- 1 syslog adm 444680 Sep 20 02:19 mail.log.2.gz
We can use rm command to clean them.
That’s all friends! I hope it helps.
loading...
About Hardono
Incoming Search
linux, ubuntu