MarlboroMan

Well-Known Member
Dec 7, 2001
64
0
306
Noticed this on a couple of boxes. The one in this example is running 10.9.0-STABLE_38.

Logs are being truncated daily. Traced it down to the "Keep log files at the end of the month (default is off as you can run out of disk space quickly)" setting in WHM, which controls "keeplogs" in the /var/cpanel/cpanel.config file.

Looking at /usr/local/cpanel/cpanellogd, it appears that if keeplogs is not set, logs are truncated every time they are processed (every day, in this case), not kept for a month:

(In dologs(), which is ran against each user every "cycle" days):

Code:
      if ( ! $CPCONF{'keeplogs'} ) {
         foreach my $log (keys %LOGS) {
            if (-f $log && $log !~ /^[\s\t\r\n]+$/) { resetfile($log); }
         }
      }

sub resetfile {
   my $file = shift;
   open(RFILE,'+<',$file);
   truncate(RFILE,0);
   close(RFILE);
}
Is this as intended? If so, the WHM setting is misleading, as it implies that if not checked, logs will be kept for a month, instead of truncated daily.