Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

We have logrotate working for several Centos servers. One new server has a slightly different setup, and for some reason logrotate does not work for the httpd service. When I start it manually, it does work as expected. I've set this up last week, and it didn't run once in four days.

The file /etc/cron.daily/logrotate exists, so I guess the cron job should run daily.

Contents of /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

# use date as a suffix of the rotated file
dateext

# 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 and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

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

Contents of /etc/logrotate.d/httpd. I suppose these override the logrotate.conf settings.

/var/log/httpd/*log {
    daily
    compress
    rotate 20
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

Why doesn't it work?

share|improve this question

closed as off-topic by Anthon, jasonwryan, Michael Homer, terdon Jul 16 at 10:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Anthon, jasonwryan, Michael Homer, terdon
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Do you have cron service running? logrotate gets launched by cron, in CentOS with the file /etc/cron.daily/logrotate. Also, what are the symptoms why is not working? Where are the logs that are not rotated? –  Pablo Martinez Jul 14 at 8:44
    
As I explained in the question, when I run logrotate manually, it works, so the location of the logs is set properly. However, when I try a test cron script, that does not run. –  SPRBRN Jul 14 at 10:06
    
I've changed my question as it appears to be a cron problem! –  SPRBRN Jul 14 at 10:29
1  
can you check /var/log/cron, also syntax is correct, do you have permissions to write into /home/john/crontest.txt ? what you get from cli when you issue following commnad ? –  klerk Jul 14 at 10:37
    
I see this in the cron log: (root) FAILED to authorize user with PAM (Module is unknown). I can run the test script from the CLI. –  SPRBRN Jul 14 at 10:47

1 Answer 1

up vote 0 down vote accepted

The cron was not running. After a restart the cron worked, and logrotate started to work as well.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.