1

I want to rotate the files under /var/log/httpd folder in that way:

  1. rotate the log file every week

  2. log files will rotated 5 times before being removed

so I think to add the following values to /etc/logrotate.d/httpd file

weekly

rotate 5

please advice if this all what I need in order to rotate the files? The current configuration not rotating the logs. The current configuration on my red-hat machine version 6.5 is as follows :

 # ls -ltr

   -rw-r--r-- 1 root root  1003 Aug  7 13:49 error_log
   -rw-r--r-- 1 root root   476 Aug  7 13:49 access_log
   -rw-r--r-- 1 root root   231 Aug  8 07:21 ssl_request_log
   -rw-r--r-- 1 root root   201 Aug  8 07:21 ssl_access_log



# chkconfig --list |grep cron
  crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off

# /etc/init.d/crond status
  crond (pid  1528) is running...




# 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

# 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.





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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.