-2

My primary partition is running out of storage so I scanned my system for files larger than 50MBs using,

sudo find / -type f -size +50M -exec du -h {} \; | sort -n

and I got

3.4G    /var/log/user.log
3.5G    /var/log/messages
3.8G    /var/log/syslog
57M     /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/user-1000@0005ac085c8d7ba9-cf9aa9ed29211912.journal~
57M     /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/user-1000@0005ac762fd0c667-79d328077f2a1441.journal~
129M    /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/user-1000@eab408d6ed9a489f80204676d10dcc8f-00000000000c0054-0005ac611037d27c.journal
129M    /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/user-1000@eab408d6ed9a489f80204676d10dcc8f-00000000000e0084-0005ac6150518d34.journal
129M    /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/user-1000@eab408d6ed9a489f80204676d10dcc8f-00000000000ffe05-0005ac617074d3a6.journal   
152M    /var/log/kern.log    
208M    /var/log/daemon.log
222M    /var/log/apache2/error.log

Is it safe to delete the apache error.log file and the other log files as well?

Mike Mwanje
  • 63
  • 1
  • 13
  • I got the solution to my problem from the answers of this similar [question](https://askubuntu.com/questions/515146/very-large-log-files-what-should-i-do) – Mike Mwanje Aug 20 '20 at 14:54

1 Answers1

1

Actually you are in a better position to answer your own question. Most of these logs are systems/application logs. I suggest you do some research to try to understand what are these logs file before you delete them.

But to free up disk space, I suggest instead of deleting, you should truncate these log file.

> /var/log/user.log
> /var/log/apache2/error.log

You can read more on rm vs truncate pro and cons.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Adeel Ahmad
  • 1,671
  • 1
  • 17
  • 22
  • Can you truncate the Apache error log in Windows? When I try, the file is In Use. I can truncate the php error log just fine. – David Spector Nov 24 '22 at 19:03