Logrotate scripts --- trying to manage the rotated daily files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have downloaded logrotate to manage the system logs for many remote systems; therefore, I have created seperate files for each server and placed them in the /etc/logrotate.d as per man pages.

The following is a sample config of what I have done so far.  All of the servers are configured very similar since this is the first stages of configuring a dedicated syslog-ng server.

/etc/logrotate.conf

# !/bin/bash
#
# Global Setting to compress log files after rotation
# and to create new (empty) log files after rotating old ones
#
daily
rotate 7
missingok
create
#
#   RPM packages drop log rotation information into this directory
include /etc/logrotate.d
#



/etc/logrotate.d/servername

 !/bin/bash
# Servername Log Rotation
#
/var/log/servername/servername.log {
        prerotate
        /bin/cp -f /var/log/servername/servername.log /var/log/servername/servername.log.`date +%b%d%y`
        endscript
        olddir /var/log/servername/servername.old
        }


My goal is to rotate the logs every day, rename the log to reflect the date, then after 7 days, place them in the servername.old directory.  This is not working, but there is no errors running the cron jobs and no errors reflected in root's mail.  Also, each time that syslog-ng service is stopped and started, the log is renamed to servername.log.1 or servername.log.2 and so on so forth which is not my ultimate solution.

Can anyone lend some advise to reach what I am wanting to achieve in minipulating the rotation of my system logfiles?






Sincerely,

Laura Noe


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux