Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rotate log files 1

Status
Not open for further replies.

bcardona

Programmer
May 10, 2001
103
US
i was told that i had to rotate log files because one was getting to big, but im not sure how to do that. im using red hat adv.2.1, any help is apprecitated.

thanks
bc
 
do i have to manually put all the log files i want to rotate and delete in logrotate.conf, ex.

my maillog and messages log files grow rapidly, so do i put

/var/log/maillog
/var/log/messages in the conf file?
 
logrotate.conf

Code:
# 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
    create 0664 root utmp
    rotate 1
}

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

example: /etc/logrotate.d/named
Code:
/var/log/named.log {
    missingok
    create 0644 named named
    postrotate
        /sbin/service named reload  2> /dev/null > /dev/null || true
    endscript
}

example: /etc/logrotate.d/syslog
Code:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

example: /etc/logrotate.d/spamd
Code:
/var/log/spamd.log {
    missingok
    notifempty
    size 30k
    create 0600 root root
}

D.E.R. Management - IT Project Management Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top