LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   does logrotate set size to 1048576 bytes by default if no size is specified? (https://www.linuxquestions.org/questions/red-hat-31/does-logrotate-set-size-to-1048576-bytes-by-default-if-no-size-is-specified-699045/)

finebanana 01-22-2009 12:10 AM

does logrotate set size to 1048576 bytes by default if no size is specified?
 
Hi Folks,

I'm running the stock Apache 2 that comes with CentOS 5.1 and quite puzzled with the behavior of logrotate in rotating the httpd logs. I'm still using the default configs for both apache and logrotate. My problem is that the apache logs (/var/log/httpd/*log) gets rotated based on file size of 1MB but I can't seem to find where this is set.

As I mentioned above, all the config are as is since I havent touch them at all. The logrotate config for httpd doesnt specify how often the rotation will be done nor does it mentioned abt the size:

Code:

# cat /etc/logrotate.d/httpd
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

so I assume it will be rotated on a weekly basis according to the system-wide logrotate config below:

Code:

# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    minsize 1M
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.

but strangely, the /var/log/httpd/*log gets rotated based on size instead (check out the line the said rotating pattern: /var/log/httpd/*log 1048576 bytes:

Code:

]# /usr/sbin/logrotate -d /etc/logrotate.d/httpd
reading config file /etc/logrotate.d/httpd
reading config info for /var/log/httpd/*log

Handling 1 logs

rotating pattern: /var/log/httpd/*log  1048576 bytes (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/httpd/access_log
  log needs rotating
considering log /var/log/httpd/error_log
  log needs rotating
rotating log /var/log/httpd/access_log, log->rotateCount is 0
renaming /var/log/httpd/access_log.1 to /var/log/httpd/access_log.2 (rotatecount 1, logstart 1, i 1),
renaming /var/log/httpd/access_log.0 to /var/log/httpd/access_log.1 (rotatecount 1, logstart 1, i 0),
rotating log /var/log/httpd/error_log, log->rotateCount is 0
renaming /var/log/httpd/error_log.1 to /var/log/httpd/error_log.2 (rotatecount 1, logstart 1, i 1),
renaming /var/log/httpd/error_log.0 to /var/log/httpd/error_log.1 (rotatecount 1, logstart 1, i 0),
renaming /var/log/httpd/access_log to /var/log/httpd/access_log.1
disposeName will be /var/log/httpd/access_log.1
renaming /var/log/httpd/error_log to /var/log/httpd/error_log.1
disposeName will be /var/log/httpd/error_log.1
running postrotate script
running script with arg /var/log/httpd/*log : "
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
"
removing old log /var/log/httpd/access_log.1
removing old log /var/log/httpd/error_log.1

The size limit for httpd is not set at all:

Code:

# grep size /etc/logrotate.d/*?
/etc/logrotate.d/acpid:    size=64k
/etc/logrotate.d/conman:  size=5M
/etc/logrotate.d/yum:    size 30k

Can anyone running CentOS confirm this behavior? Any explaination on this?

Thanks!


All times are GMT -5. The time now is 08:06 PM.