2

Im relatively new to Ubuntu, please be gentle.

System has just crashed while trying to learn Blender.

Rebooted machine many times and now it is booting up OK, but I have noticed I have very little disk space available.

/var/log is showing 1TB of use, & /var/log/journal 4.2GB

enter image description here

Surely a system dir should not be using 50% of disk space.

Is there anything I can delete or use to clean this up?

I am not good in Terminal, but can find my way around. Thanks

graham
  • 10,436
DaveW
  • 21
  • This is about logs (informations of what happened in your system). I think you can clear logs by using the GUI application bleachbit. – Jeryosh Jan 19 '20 at 09:51
  • Please not bleachbit. can you show journalctl --list-boots Maybe journal is persistent. and cat /proc/cmdline – nobody Jan 19 '20 at 09:56
  • @nobody i have run those commands but cant find a way of posting the output here, says too many characters – DaveW Jan 19 '20 at 10:14
  • Then paste it to https://paste.ubuntu.com/ – nobody Jan 19 '20 at 10:17
  • Upps edit your question and add the link there. – nobody Jan 19 '20 at 11:43
  • @nobody thanks. http://paste.ubuntu.com/p/cqGH99hMgW/plain/ – DaveW Jan 19 '20 at 12:12
  • even persitent jourmal does not explain the size. cut -d "]" -f2- /var/log/syslog | sort | uniq -c | sort -n | tail -10 this shows tthe most upcomming messages in syslog. – nobody Jan 19 '20 at 12:59
  • @nobody Nothing happened when pasting that command. But if you look at the attached list of files, the kern.log is 466GB, & syslog is 355GB, Could they be safely deleted???? https://paste.ubuntu.com/p/3smMWmSS2J/plain/ – DaveW Jan 19 '20 at 14:10
  • another try this files are too big. tail -n60 /var/log/syslog pkease. – nobody Jan 19 '20 at 15:26
  • https://paste.ubuntu.com/p/5gHPp3QBYN/ UFW seems to be mentioned a lot, as i have the logs on Full for that firewall. but under/var/log/ufw.log is approx 25GB, not the 700 GB that the other two mentioned files were taking up. – DaveW Jan 19 '20 at 16:04
  • Ok, thanks for the help above. I have now deleted those large files, but will keep an eye on them if they grow that large again, guessing something is wrong if it happens again. Maybe more questions to come at a later date. – DaveW Jan 19 '20 at 21:36

1 Answers1

0

Let us a little bit clean. It is not a good behavior to erase log files.

sudo journalctl --rotate --vacuum-time=1sec

rotate means Journal file rotation has the effect that all currently active journal files are marked as archived and renamed.

--vacuum-time Removes all archived journal files contain no data older than the specified timespan

sudo nano /etc/systemd/journald.conf 

make sure Storage=auto is set. After your next cold boot please

sudo journalctl --rotate --vacuum-time=1sec

again.

 sudo ufw logging off

This set the logging from ufw off, only logging not the firewall itselfs.

sudo logrotate -dfv /etc/logrotate.d/

this forces logrotate to make his job (rotate logfiles) Please take a look in the manpage.

man logrotate

have an eye next time to your /var/log/syslog and /var/log/kern.log

If they grow again

tail -n60 /var/log/syslog

for syslog

tail -n60 /var/log/kern.log

for kern.log

nobody
  • 5,437