7

To be specific I want to stop the kern.log and syslog files. I just installed Xunbuntu about 2 days ago and have no experience with this OS.

I know they are supposedly important, but I have a hardware issue that leaves them running into the gigabytes.

My partition is small so I don't have a whole lot of free space for these files. In addition Im running Xunbuntu on a SSD so all this writing to the disk is annoying me. So if I could prevent their creation, that would be great.

For the curious that must know the issue. Im getting a nonstop log entry along the lines of "iwl3945...Radio disabled by HW RF Kill switch"

Everything is operating fine. LAN, WiFi, and Bluetooth all work as they should. The log entries begin when I don't have a CAT5 cable connected or if I set the wifi hardware switch to the off position. And even when I do have them connected I have to enter a web browser before they acknowledge and verify a connection to the internet before the writing stops.

I can't have an always online connection with this computer. It will probably spend more time offline. I also like to turn off the wifi hard switch to conserve battery.

6

If you really want to disable all logging:

  1. Type sudo stop rsyslog to stop the log daemon.
  2. Create a file called /etc/init/rsyslog.override with a single line manual to stop the log daemon being automatically started at boot. You can do this with the following command:

    echo manual|sudo tee --append /etc/init/rsyslog.override
    

If you ever want to undo this:

  1. Type sudo start rsyslog to start the log daemon.
  2. Delete the override file you created before, so that the log daemon is again started at boot. The command sudo rm -f /etc/init/rsyslog.override will do this for you.
  • +1 I did this in my virtual machine server and it's saving me growing my VMDK for nothing. Nice one-liner! – msanford Aug 14 '13 at 15:28
  • This will not work on 16.04 as my instructions above are upstart-specific. Somebody should add another answer for the systemd case. – Robie Basak Aug 17 '16 at 11:51
  • @RobieBasak I suspect that it would be sudo systemctl disable rsyslog.service syslog.service (and enable to reverse the change) which I'd follow up with the same command swapping stop for status to confirm the result. There may be other services to stop, Ubuntu will do tab-completion on them; sudo systemctl list-unit-files | grep log might help out. – pbhj Oct 14 '16 at 19:08
  • That sounds about right, though you probably want systemctl mask and not systemctl disable. – Robie Basak Oct 16 '16 at 17:15
0

You could configure so there are no such log files. But it's better to just install the package logrotate and configure maximum size and number of log files you want to save. So you could easy configure to have max size 100MB and 5 of them in /etc/logrotate.conf and/or add files to /etc/logrotate.d/. Just look at the examples there.

So

apt-get install logrotate

and check the configurations for the package as noted above (and read /usr/share/doc/logrotate/README.Debian).

  • 1
    You may also need to increase the log rotation interval if the default of daily isn't enough. – Robie Basak Jul 4 '13 at 12:31
  • What he said - I had my logs set to keep 5 logs of up to 10MB each, or somesuch, but they'd grown to 13GB each for syslog, messages and kern.log because they weren't set to rotate often enough. – pbhj Oct 14 '16 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.