Automatically rotate log file

Hi
I am facing issue that my asterisk log file size approach to 40 , 45 GB. Is any mechanism that after a specific limit e.g 500 MB automatically create new log file.

linux.die.net/man/8/logrotate

Hi

Make sure that you have the file logrotate.conf and in that you have the line :-

RPM packages drop log rotation information into this directory

include /etc/logrotate.d

then in the /etc/logrotate.d you have a file called asterisk

[code]cat asterisk
/var/log/asterisk/*log {
missingok
rotate 5
weekly
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/full {
missingok
rotate 5
daily
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/messages {
missingok
rotate 10
weekly
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx ‘logger reload’ > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/cdr-csv/*csv {
missingok
rotate 5
monthly
create 0640 asterisk asterisk
}

/var/log/atftp.log {
missingok
rotate 5
monthly
create 0640 nobody nobody
}
[/code]

you can adjust the frequancy and number to store as you wish

Thanks for prompt help

Issue has been resolved.