Many software comes with cutting logs, such as Tomcat, which can be named by time. Rsyslog can generate files by date, but does not support "% $year%-% $month%-% $day%" These variables to read the file (current version number: rsyslog-8.17.0-1.el6.x86_64).
Then, you need to use the log polling logrotate.
overview, configuration.
Global configuration:/etc/logrotate.conf
Local configuration:/etc/logrotate.d/for ease of administration, custom configurations are put into/etc/logrotate.d/
Use.
Create file tomcat-log.conf, this file name can be random, you can have no suffix.
Vi/etc/logrotate.d/tomcat-log.conf
#tomcat里catalina. Out log path/tomcat/logs/catalina.out {#按天执行 daily #按日期保存旧文件 dateext #最多5个备份 rotate 5 #忽略错误 mi Ssingok #日志为空, do not poll notifempty #创建指定用户和权限的文件 while logrotate modify old file name create 644 root}
Reference article:
Http://linux.cn/article-4126-1.html
Http://blog.csdn.net/cjwid/article/details/1690101
This article is from the "Enlightened Grocery store" blog, please be sure to keep this source http://wutou.blog.51cto.com/615096/1767968
Syslog-ng+rsyslog Collection log: Logrotate log cut, poll (vii)