Problem with logrotate

Discussion in 'General Linux' started by mnowak02, Apr 2, 2013.

  1. mnowak02

    mnowak02 New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hey
    I got logrotate file like below

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

    And I would like to change file messages located in /var/log/ when there are a lot of logs inside. After reach 500MB size I want to copy to /var/log/old and the old file messages was clear and so on. I want that files in /var/log/old have various name e.g. messages_date,messages_date.....
    Can you look that everything is ok?Have I change only file logrotate.conf or something else??

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


    /var/log/messages
    {
    rotate 20
    create
    size=500M #or size 500M ??
    olddir /var/log/old
    }
  2. old_bolvan

    old_bolvan New Member

    Messages:
    15
    Likes Received:
    3
    Trophy Points:
    3
    size 500M
    Also syslog must be restarted. Something like:
    Code:
    postrotate
    killall -HUP syslogd #or "reload rsyslog"
    endscript
    Take look at /etc/logrotate.d/*syslog*

Share This Page