2月 242017
 

过滤Tomcat日志文件catalina.out中的启动记录

# grep 'org.apache.catalina.startup.Catalina start' /data/tomcat/logs/catalina.out |less
Jan 16, 2017 10:57:49 PM org.apache.catalina.startup.Catalina start
Jan 17, 2017 11:17:17 AM org.apache.catalina.startup.Catalina start
Jan 17, 2017 7:08:31 PM org.apache.catalina.startup.Catalina start
Jan 18, 2017 10:39:09 AM org.apache.catalina.startup.Catalina start
Jan 18, 2017 3:54:37 PM org.apache.catalina.startup.Catalina start
Jan 18, 2017 7:54:06 PM org.apache.catalina.startup.Catalina start
Jan 20, 2017 2:39:36 PM org.apache.catalina.startup.Catalina start
Jan 20, 2017 7:57:22 PM org.apache.catalina.startup.Catalina start
Jan 22, 2017 2:07:31 PM org.apache.catalina.startup.Catalina start
Jan 22, 2017 4:18:44 PM org.apache.catalina.startup.Catalina start
Jan 24, 2017 4:05:56 PM org.apache.catalina.startup.Catalina start
Jan 24, 2017 6:00:29 PM org.apache.catalina.startup.Catalina start
Feb 07, 2017 10:16:15 AM org.apache.catalina.startup.Catalina start
Feb 09, 2017 6:42:21 PM org.apache.catalina.startup.Catalina start
Feb 10, 2017 9:24:40 AM org.apache.catalina.startup.Catalina start
Feb 21, 2017 2:18:17 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 3:48:38 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 3:52:05 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:44:43 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:50:22 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:57:02 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 6:37:05 PM org.apache.catalina.startup.Catalina start
Feb 23, 2017 3:33:05 PM org.apache.catalina.startup.Catalina start

每日处理日志并将前一日结果写入文件

grep 'org.apache.catalina.startup.Catalina start' /data/tomcat/logs/catalina.out |\
grep "`date -d yesterday +%b\ %d\,\ %Y`" > tomcat.`date -d last-day +%Y%m%d`.txt;

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据