Compress CPanel Domlogs log files

Before setting up compression of your logs you will want to have cpanel run the stats as often as possible. This is so you do not miss any stats that would have been included were your logs not compressed before stats run.

To do this, login to WHM, and click on Tweak Settings under Server Configuration in the left menu. Scroll down to Stats and Logs, and then in the field next to “Number of days between processing log files and bandwidth usage (default 1, decimal values are ok):” enter ‘.5′.

This will cause your logs to be run twice a day, and should allow you to have up to date stats.

After doing this, we can begin to setup your domlogs compression. You will need to open an ssh shell to your server to complete this.

Change directories to /etc/logrotate.d/ and find the file named httpd. You will need to copy this file to a new file in the same directory:

root@cpdemo [/etc/logrotate.d]# cp httpd domlogs
root@cpdemo [/etc/logrotate.d]# ls -la domlogs
-rw-r–r– 1 root root 390 Nov 8 21:26 domlogs
root@cpdemo [/etc/logrotate.d]#

Now you will want to edit your new file to contain the following:

/usr/local/apache/logs/*.com /usr/local/apache/logs/*.org /usr/local/apache/logs/*.net {
missingok
notifempty
size=200M
rotate 2
compress
sharedscripts
postrotate
/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

Just save your new file and you are done. Most linux distributions come default with a logrotate cronjob running nightly that will work with this configuration.

  • 3 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

The password you provided is not correct. Trace Output: (root@***.***.***.***’s password: ==sshcontroloutput== sshcmdpermissiondeny

The above error troubles you sometimes while doing multiple transfer via Cpanel to Cpanel server,...

Fantastico is not installed at the default location

Today while installing fantastico on one of our server, We came across the following error....

Phpmyadmin failed (Cpanel) Warning: session_start() [function.session-start]: SQLite

Phpmyadmin fails to load and gives the below error. ==== Error ==== Warning: session_start()...

Found suspicious scripts in /tmp directory

Sometimes its very frustating to find how the suspicious files are stored in /tmp directory....

Spamd keeps failing

SSH to the server and run the following commands (in order): ps auxfww | grep spamd kill -9 PID...