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/[email protected]~
57M /var/log/journal/979a37e4ed2a4f8bb22add990526b81f/[email protected]~
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?
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.