{"id":3481,"date":"2014-08-22T20:38:39","date_gmt":"2014-08-22T12:38:39","guid":{"rendered":"http:\/\/rmohan.com\/?p=3481"},"modified":"2014-08-22T21:09:29","modified_gmt":"2014-08-22T13:09:29","slug":"catalina-out-log-rotation","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3481","title":{"rendered":"catalina.out log rotation"},"content":{"rendered":"<p style=\"color: #444444;\">Hi,<\/p>\n<p style=\"color: #444444;\">I am interested in catalina.out log file rotation, I have an application where logging to catalina.out is very huge, say 0.5 MB \/ sec.<\/p>\n<p style=\"color: #444444;\">So I have written one script to handle this which is shown below.<\/p>\n<p style=\"color: #444444;\"># crontab -l | grep catalina<\/p>\n<p style=\"color: #444444;\">0,30 * * * * bash \/catalina_log_handler.sh\u00a0 &gt;\/dev\/null 2&gt;&amp;1<\/p>\n<p style=\"color: #444444;\"># more \/catalina_log_handler.sh<\/p>\n<p style=\"color: #444444;\">#!\/bin\/sh<\/p>\n<p style=\"color: #444444;\">CATLOC=\/bin\/cat<\/p>\n<p style=\"color: #444444;\">SEDLOC=\/usr\/bin\/sed<\/p>\n<p style=\"color: #444444;\">$CATLOC \/catalina.out &gt;&gt; \/catalina_backup.out \u00e0 take a backup and then handle this file rotation using logadm<\/p>\n<p style=\"color: #444444;\">$SEDLOC &#8221; catalina.out &gt; catalina.out \u00e0 Empty this file<\/p>\n<p style=\"color: #444444;\">There are two cases here<\/p>\n<p style=\"color: #444444;\">1.)\u00a0\u00a0\u00a0\u00a0 The below is normal behavior where not much logging<\/p>\n<p style=\"color: #444444;\"># ls -ltrh catalina*<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15K Jan 31 12:07 catalina.2012-01-31.log<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.9K Feb\u00a0 1 06:26 catalina.2012-02-01.log<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 345K Feb\u00a0 1 06:45 catalina.out<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14M Feb\u00a0 1 07:00 catalina_backup.out<\/p>\n<p style=\"color: #444444;\">2.)\u00a0\u00a0\u00a0 The below is heavy logging behavior<\/p>\n<p style=\"color: #444444;\"># ls -ltrh catalina*<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.2K Jan 28 22:14 catalina.2012-01-28.log\u00a0<strong>\u00e0<\/strong><strong>\u00a0why I am seeing catalina file with date, have the same content as catalina.out<\/strong><\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 362 Jan 30 06:30 catalina.2012-01-30.log<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10M Jan 30 14:43 catalina.out.2<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.7M Jan 30 17:00 catalina_backup.out.9.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.6M Jan 30 20:00 catalina_backup.out.8.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.6M Jan 30 23:00 catalina_backup.out.7.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.6M Jan 31 02:00 catalina_backup.out.6.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems \u00a0\u00a0\u00a0\u00a0\u00a0ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 113M Jan 31 03:30 catalina.out.3<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.8M Jan 31 06:00 catalina_backup.out.5.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6.2M Jan 31 10:04 catalina.out<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.5K Jan 31 10:04 catalina.2012-01-31.log<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.8M Jan 31 10:30 catalina_backup.out.4.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.8M Jan 31 15:00 catalina_backup.out.3.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.8M Jan 31 19:30 catalina_backup.out.2.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1.8M Feb\u00a0 1 00:00 catalina_backup.out.1.gz<\/p>\n<p style=\"color: #444444;\">-rw-r&#8211;r&#8211;\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 12M Feb\u00a0 1 01:00 catalina_backup.out<\/p>\n<p style=\"color: #444444;\">-rw-r&#8212;&#8211;\u00a0\u00a0 1 ems\u00a0\u00a0\u00a0\u00a0\u00a0 ems\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 12M Feb\u00a0 1 01:12 catalina.out.1\u00a0<strong>\u00e0<\/strong><strong>\u00a0why this is latest file ?<\/strong>\u00a0<strong>Is this because of huge logging, Can I disable default catalina.out rotation so that my script will take care of moving the content from catalina.out to catalina_backup.out\u2026<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p style=\"color: #444444;\">Hi,<\/p>\n<p style=\"color: #444444;\">I am interested in catalina.out log file rotation, I have an application where logging to catalina.out is very huge, say 0.5 MB \/ sec.<\/p>\n<p style=\"color: #444444;\">So I have written one script to handle this which is shown below.<\/p>\n<p style=\"color: #444444;\"># crontab -l | grep catalina<\/p>\n<p style=\"color: #444444;\">0,30 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3481"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3481"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3481\/revisions"}],"predecessor-version":[{"id":3483,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3481\/revisions\/3483"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}