1

Tracking ubuntu 14.04.3 firewall info I enabled ufw full login for a while (now turned back off). Now I'm warned I run out of space in the /var partition. Looking there in I find 3 huge files: kern.log, syslog and ufw.log, each 1.2GB. How do I force some existing routine (if there is one) to anticipate the scheduled job of cleaning/compressing/or-whatever the logs?

Thank you

useful
  • 1,927
  • 6
  • 26
  • 32

2 Answers2

3

Take a look @ logrotate package, you can see a tutorial on this page

you could either

  • Lower the level of logging of your firewall: modify the LOGLEVEL directive into the /etc/ufw/ufw.conf file to one of 'off', 'low', 'medium', 'high' and sudo service ufw restart
  • reconfigure your firewall so that it logs in another part where you have more space
  • configure logrotate to rotate the logs more frequently instead of being into /etc/cron.daily/logrotate for example into /etc/cron.hourly/logrotate (see this post)
    1. sudo ln -s /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
    2. Modify the /etc/logrotate.d/ufw file according to this post to manage the size of rotation and man logrotate for more configuration options. It could be that your file is not rotated because of file size which is not setted, by default the size directive is not setted into the /etc/logrotate.d/ufw file so it is only rotated weekly according to the configuration file directive. So changing it putting a size directive (for example size 300M) will do what you expect maybe. Please note: If the size directive is used, logrotate will ignore the daily, weekly, monthly, and yearly directives. If you want logrotate to consider both log size AND timestamp, the minsize directive should be used.
    3. Run manually if you want the logrotate job to test it with sudo /etc/cron.daily/logrotate
    4. Check the logrotate jobs into the /var/lib/logrotate/status file (see this post)
  • If you don't want ufw to log into your kern.log check this post
0

I just deleted the log and posted a bug : https://bugs.launchpad.net/ubuntu/+source/logrotate/+bug/1530904 For kern.log and syslog I hope the night will help.

useful
  • 1,927
  • 6
  • 26
  • 32