You need to install logratate
Sudo apt-get update
Sudo apt-get install logrotate
For confirm logrotate successfully installed or not run :
logrotate
Default logrotate configuration are present in :
/etc/logrotate.conf
Example :
/var/log/tomcat7/catalina.out {
copytruncate
weekly
rotate 52
compress
missingok
create 640 tomcat7
adm
size 5M
}
What does it means :
Copytruncate : Truncate
the original log
file to zero size in place after creating a copy,
instead of moving
the old log
file and optionally creating a new one. It
can be used when some program cannot
be told to close its logfile and
thus might continue writing
(appending) to the previous log file forever.
Note that there is
a very small time slice between copying
the file and truncating it, so
some logging data might be lost.
When this option
is used, the create option will have no
effect, as the old log
file stays in place.
Weekly : Rotate logs
once per week. Available options are daily, weekly, monthly, and yearly
Rotate 52 : Keep 52
files before deleting old log files (Thats a default of 52 weeks, or one years
worth of logs!)
Compress : compress
log files.
Missingok : If
the log file
is missing, go on
to the next one without issuing
an error message
Create 640 tomcat7 adm : create <mode> <owner>
<group>
Size 5 M : if log
size is bigger than size than it would be rotated.
Comments
Post a Comment
Thanks for your concern.