1

Sorry if it's a stupid question. I would like to free up some space and /var/log is full of logs. I do not intend to use any of the log files, so I don't care if they get deleted or not. But I afraid that it may affect the functionality of the services that produce logs. I understand that it may depend on the program that produces the logs. but Do you think it would be safe to remove regular services and system log such as:

alternatives.log
auth.log
boot.log                 
mail.log     
syslog
dmesg
dpkg
faillog
fontconfig.log
kern.log
wtmp
nginx/*
apt/*
btmp
  • I wouldn't actually delete them but configure logrotate to compress and dispose of them sooner (i.e. not keep 7 generations but just 2 for example). – PerlDuck Oct 3 '18 at 11:04
  • 1
    Few single-users intend to review their logfiles. But when something breaks those files can be invaluable. Record how to undo whatever solution you choose in case you need logging in the future. – user535733 Oct 3 '18 at 11:28
0

It is actually safe. you can also zero them out > /var/log/nginx/error.log for example. You can also but these in a script and call it with cron

Crontab: 1 5 */2 * 0 /home/user/scripts/delnginxlogs.sh

Actual script:

cd /var/log/nginx
rm *.gz
> domain-ssl-access.log
> domain.org-ssl-error.log
> domain.com-ssl-access.log
> domain.com.-ssl-error.log

etc,etc

| improve this answer | |

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