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
Alex
  • 211
  • 4
  • 13
  • 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 03 '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 03 '18 at 11:28

1 Answers1

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

PerlDuck
  • 13,014
  • 1
  • 36
  • 60
  • Funny schedule for the cronjob: it means [_At 05:01 on every 2nd day-of-month if it's on Sunday._](https://crontab.guru/#1_5_*/2_*_0) ;-) _My_ computer isn't usually turned on at that time. – PerlDuck Oct 03 '18 at 10:24
  • I saw you got an nginx in there. I assumed its a web server Btw if the answer suits you lpease vote and accept it. ty – Fanosss test Oct 03 '18 at 10:49
  • You shouldn't push the OP after just ~40 minutes to upvote and/or accept an answer. Instead, let the OP take his/her time and after some time you _may_ point them to [_What should I do when someone answers my question?_](https://askubuntu.com/help/someone-answers) instead. – PerlDuck Oct 03 '18 at 11:00