The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Domlog Rotation

Discussion in 'General Discussion' started by sparek-3, Aug 7, 2009.

  1. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    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.
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    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.
     
  3. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    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.
     

    Attached Files:

  4. Chipote

    Chipote Registered

    Joined:
    Oct 6, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
Loading...

Share This Page