Continuous reduction of hosting space

Started by askinj, August 10, 2016, 03:48:02 PM

Previous topic - Next topic

askinj

Hello
The VPS server I use CWP panel, decreasing the area to be used about 100 MB each day. We had 12GB of free space from 6GB. Can you help with this?

idovecer

Quote from: askinj on August 10, 2016, 03:48:02 PM
Hello
The VPS server I use CWP panel, decreasing the area to be used about 100 MB each day. We had 12GB of free space from 6GB. Can you help with this?

Firstly install ncdu with
# yum install ncdu.

After that start ncdu. With that tool you can easily see what's taking your space.


Also you can clean some system apache logs.
Notice: First command list them all, so you can check them before cleaning, second command truncates to nothing.

# apache domain logs
# find /usr/local/apache/domlogs/ -type f -name "*.log" -exec ls -if {} \;
# find /usr/local/apache/domlogs/ -type f -name "*.log" -exec truncate --size 0 {} \;

# php-fpm system logs
# find /opt/alt/php-fpm*/usr/var/log/ -type f -name "php-fpm.log" -exec ls -if {} \;
# find /opt/alt/php-fpm*/usr/var/log/ -type f -name "php-fpm.log" -exec truncate --size 0 {} \;

# apache logs
# find /usr/local/apache/logs/ -type f -name "*log" -exec ls -if {} \;
# find /usr/local/apache/logs/ -type f -name "*log" -exec truncate --size 0 {} \;

# dovecot logs
# find /var/log/dovecot-* -type f -name "*log" -exec ls -if {} \;
# find /var/log/dovecot-* -type f -name "*log" -exec truncate --size 0 {} \;

# cwp_stats home folder clean
# find /home/*/cwp_stats/goaccess/ -type f -name "*.html" -exec ls -if {} \;
# find /home/*/cwp_stats/goaccess/ -type f -name "*.html" -exec rm {} \;


josemnunez

remember to restart the services after deleting the files

overseer

And consider implementing logrotate so you don't wind up with ever-bloating log files. Keep 7 (or at least 4) compressed logs, rotated weekly. Then you can still look back at errors, traffic patterns, or security breaches but not have to contend with log bloat!