sparek-3

Well-Known Member
Aug 10, 2002
2,120
255
388
cPanel Access Level
Root Administrator
Is there a particular time or particular process that is responsible for emptying the Apache domlogs at the end of each month?

I've never been able to find out specifically when this process runs. It always seems to be near the end of the month, but never an exact time.

Is there a process that does this emptying? Is there a pre-hook for this process?

I am wanting to back up some of the domlogs before they are emptied out and I'm just wondering if there is a way to get this to run just before the domlogs are emptied.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
This is handled by the cpanellogd process. There are some tweak settings that change how the logs are handled. Do either of these address your concerns:

Delete each domain's access logs after stats run

Keep log files at the end of the month (default is off as you can run out of disk space quickly)


To my knowledge there is no way to hook into this process.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,120
255
388
cPanel Access Level
Root Administrator
I think you might be able to change the file /usr/local/cpanel/Cpanel/Logd.pm and add something like:

Code:
if (-x "/scripts/prelogrotate") {
	system("/scripts/prelogrotate", $log);
}
before the resetfile($log) call.

This would allow administrators to create their own /scripts/prelogrotate where they could back up $log as they see fit, if they wanted to keep the previous month's logs in another location.

See the attached patch file.
 

Attachments

Chipote

Registered
Oct 6, 2009
1
0
51
Any idea on what the rotation frequency is dependent on? It doesn't seem to be a fixed time, from my experience. Is it based on size of the access log or some other parameters?