How to clear system log?
To get stat about system storage
sudo du -h --max-depth=1 / 2>/dev/null | sort -h
Result:
0 /dev
0 /proc
0 /sys
4.0K /home
4.0K /mnt
4.0K /srv
8.0K /build
12K /media
16K /lost+found
60K /tmp
192K /ephe
2.9M /run
5.8M /etc
164M /opt
219M /boot
841M /snap
3.2G /usr
15G /root
27G /var
51G /
Check the var directory with sudo du -h --max-depth=1 /var 2>/dev/null | sort -h
. Result:
4.0K /var/crash
4.0K /var/local
4.0K /var/mail
4.0K /var/opt
36K /var/tmp
48K /var/snap
1.7M /var/backups
2.6M /var/spool
114M /var/cache
7.7G /var/log
22G /var/lib
30G /var
To clear system log, under /var/log
. To leave the latest 500MB:
journalctl --vacuum-size=500M
Result:
Vacuuming done, freed 0B of archived journals from /run/log/journal.
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000013c2c59-0005fec131c087c3.journal (16.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000013c6746-0005fec141f2d31d.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000013ed1fd-0005fec292ba2aec.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000141428d-0005fec344f94bf2.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000143b3b6-0005fec40d477878.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000014624dc-0005fec4e23fe94c.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000014896ea-0005fec614ad455f.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000014b0666-0005fec6f19dc944.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000014d771a-0005fec7dee4f64e.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000014fe890-0005fec9557a00dc.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001525920-0005feca4f55e3b9.journal (96.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000153dca4-0005fecae2745ae3.journal (56.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000154f7d5-0005fecb50203a0d.journal (104.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000156b45a-0005fecbc04c140c.journal (32.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001572551-0005fecbdcd4ac97.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001573b04-0005fecbe3d3ceca.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015750ad-0005fecbea7b4049.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001576660-0005fecbf105835e.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001577c16-0005fecbfa09a23f.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015791c5-0005fecc004ab8e3.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000157a779-0005fecc07dfce2b.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000157bd21-0005fecc0eca05e2.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000157d2cd-0005fecc16b5dbf7.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000157e887-0005fecc1f09af0c.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000157fe2c-0005fecc276af0ff.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015813f0-0005fecc2dfb4b81.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001582997-0005fecc353ec6bd.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001583f59-0005fecc3b6a0f55.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158551d-0005fecc41763dc4.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001586ad6-0005fecc4659bb8d.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158808d-0005fecc4b963e15.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158963b-0005fecc517711e7.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158abe2-0005fecc57d96d99.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158c190-0005fecc5d655216.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158d746-0005fecc636a1b79.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000158ecf9-0005fecc694e3cca.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015902af-0005fecc6e48267e.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159185e-0005fecc73df2c5d.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001592e16-0005fecc79a942b3.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015943c9-0005fecc80855e35.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159598a-0005fecc85fe81d1.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001596f49-0005fecc8c5d94e4.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015984ff-0005fecc92f518f9.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001599ab4-0005fecc9924c3d2.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159b056-0005fecc9ff2c8ab.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159c607-0005fecca78d88ac.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159dbc5-0005feccaf773b3b.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000159f172-0005feccb53d9f47.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a0728-0005feccb9c30a90.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a1cd7-0005feccbe3fdc10.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a328f-0005feccc27c7257.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a483b-0005feccc70c812f.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a5df5-0005fecccf38ed81.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a73ad-0005feccd33c3028.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a896b-0005feccdacd26b7.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015a9f3e-0005fecce7774fcf.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015ab516-0005feccf20d23c8.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015acaf2-0005feccfb4cf551.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015ae0b9-0005fecd08395bee.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015af67f-0005fecd107bc1f8.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b0c53-0005fecd1d8fefa9.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b2235-0005fecd2a2e32fb.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b380e-0005fecd332e2a11.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b4dd8-0005fecd41edfb74.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b63b6-0005fecd50582247.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b797e-0005fecd593b8b21.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015b8f66-0005fecd62abf063.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015ba535-0005fecd6eb05798.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015bbafe-0005fecd7c1bdee6.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015bd0c8-0005fecd88e1d040.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015be6a2-0005fecd92508d28.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015bfc6e-0005fecda0ba5f2a.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c1233-0005fecdac9fb1e4.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c2803-0005fecdb4c94d76.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c3dd7-0005fecdbe0fa19d.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c538f-0005fecdc7358d7a.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c696b-0005fecdd03d5df0.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c7f44-0005fecdd64ecbe9.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015c951b-0005fecde0574366.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015caada-0005fecdead92eef.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015cc0b2-0005fecdf61c28c5.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015cd683-0005fecdff1e27cf.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015cec4e-0005fece065e9b9a.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015d0223-0005fece0e333615.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015d17f8-0005fece14b3efb1.journal (8.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015d2dd4-0005fece1f1e4fee.journal (64.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015e7b02-0005fecebc6b3a1c.journal (96.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000015ffee5-0005fecf5d926314.journal (112.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000161f9ad-0005fed01d19f92e.journal (16.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000162349d-0005fed02fcd1daa.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-000000000164a5f9-0005fed10be58591.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000016717e9-0005fed1f14c4b47.journal (128.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-0000000001698930-0005fed2cedddc57.journal (120.0M).
Deleted archived journal /var/log/journal/6493b9faf8566e8b87835d996022a956/system@685e3a233a8d47b19c3ccd164e23af96-00000000016bbfda-0005fed399745785.journal (128.0M).
Vacuuming done, freed 2.8G of archived journals from /var/log/journal/6493b9faf8566e8b87835d996022a956.
Vacuuming done, freed 0B of archived journals from /var/log/journal.
To keep last 2 days log only: journalctl --vacuum-time=2d
.