Ubuntu clean disk space8/28/2023 ![]() ![]() kern.log for kernel events, auth.log for authentication events, etc.). While you're at it, you may want to add the same setting in the second part of the file, which governs the behavior of other log files (e.g.Note: you can change maxsize, rotate N, and other settings to customize your logs - use the command man logrotate to see more.Note that rotate 7 means your system will only keep 7 total syslog backups so it can only ever take up 7GB of space This will force your syslog to "rotate" (i.e., create a new log file and archive the previous log file) after either 1 day or when the file becomes 1GB, whichever comes first.In this case you can edit the config with sudo nano /etc/logrotate.d/rsyslog and add one line: Then, you can force the logs to rotate and delete automatically if they reach a certain size, using logrotate. ![]() Then restart the syslog service (either systemctl restart syslog or service syslog restart).You may need to be root user for this, in which case enter sudo su, your password, and then the above command). Safely clear the logs: after looking at (or backing up) the logs to identify your system's problem, clear them by typing > /var/log/syslog (including the >).Instead, here is a safer method that lets you keep the log files while reclaiming disk space while also stopping the log files from doing this again. Also, you'll probably want those log files later when you're figuring out other system problems - disabling syslog makes it more difficult to track down future issues! The other answer removes and disables the logs entirely, which is not a good approach as it ignores the underlying issue.The accepted answer doesn't explain why the disk problem goes away if you fix the underlying system issue (the answer is logrotate), plus your system may keep writing to the logs and fill up your disk before you can even figure out the underlying issue. ![]() This is an old question, but neither of the previous two answers are good solutions: I saw that you can get the logging level by: cat /proc/sys/kernel/printk I can get the space by deleting the files, but I think it won't solve the problem.ĭoes anyone have an idea on what the issue might be? rw-r- 1 syslog adm 7.3G Feb 19 07:36 syslog.7.gzįrom the snippet above, you can easily find that kern.log and kern.log.1 is eating up 80% of my 1TB disk. rw-r- 1 syslog adm 23G Feb 25 14:52 syslog Tracing back, I find that it is the syslogs, especially the kern.log(s) that are eating up my 1TB disk. Logging into my Ubuntu machine, I get a warning that I am running out of disk space. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |