2

I have these log files:

72K     /var/log/dist-upgrade
4.0K    /var/log/samba/cores/smbd
4.0K    /var/log/samba/cores/nmbd
12K     /var/log/samba/cores
84K     /var/log/samba
44K     /var/log/gdm
4.0K    /var/log/bittorrent
1.6M    /var/log/installer
4.0K    /var/log/asterisk/cdr-custom
19M     /var/log/asterisk/cdr-csv
1.2G    /var/log/asterisk
4.0K    /var/log/apparmor
4.0K    /var/log/unattended-upgrades
36K     /var/log/cups
4.0K    /var/log/news
120K    /var/log/proftpd
12K     /var/log/fsck
28K     /var/log/apt
1.2G    /var/log

Could I please get some help cleaning these log files?

Jos
  • 29,224
Docfxit
  • 29
  • 1
  • 4
  • Is this du output? Or something else? Can you fix the formatting so it's readable? – user535733 Sep 07 '20 at 06:20
  • Asterisk logging is pretty well documented. – Jos Sep 07 '20 at 07:38
  • 1
    Normally your system will run logrotate to move and compress logs over a certain size. Logrotate keeps a configured number of each logs, and delete old ones automatically. If some logfile grows a lot. you should look in to that file and fix the problem - if any. – Soren A Sep 07 '20 at 07:41
  • question: why? The largest outside of asterisk is 120K. and see the link Jos posted on that. – Rinzwind Sep 07 '20 at 08:07

2 Answers2

2

Simple log cleanning

sudo /etc/cron.daily/logrotate

optionnal, delete log archives

sudo find /var/log -type f -iname *.gz -delete

Find more about freeing disk space on root partition : https://askubuntu.com/a/1161181/77093

cmak.fr
  • 8,696
  • 1
    This returns the following on Ubuntu:

    find: paths must precede expression: apport.log.3.gz' find: possible unquoted pattern after predicate -iname'?

    – oxr463 Feb 02 '21 at 12:57
0

by clean do you mean remove/delete?

if so then this has already been answered:

As described in those answers, to delete all logs open terminal, CTRL+ALT+T, and run:

sudo rm /var/log/*

to delete a specific log file run:

sudo rm /var/log/*nameoflogfile*.log 

Although as stated in this answer, it is also worth checking through the logs to find out what exactly is causing your logs to grow so large.

  • 1
    "sudo rm /var/log/*| No. You do > /var/log/{logfile} There are services that are active that require the log file to be present. – Rinzwind Sep 07 '20 at 08:06