Tomcat Implements log segmentation

Source: Internet
Author: User

Tomcat Log Split

Purpose of implementation:

Because of real-world production, the data in the log files generated by the Tomcat service is particularly large and the server storage space is limited. To solve the lack of space, log segmentation is implemented, and log compression is added

Environment: System version: CentOS Linux release 6.0 (Final)

Software version: cronolog-1.6.2.tar.gz


Tomcat Log Split tool Cronolog

1. Download cronolog-1.6.2.tar.gz

2. Installation

# tar zxvf cronolog-1.6.2.tar.gz#./configure--prefix=/usr/local/cronolog# make# make install

3. Settings

# cd/app/apache-tomcat-6.0.45_ip_sync/bin# VI catalina.sh found in catalian.sh (367~ Between 390 lines) org.apache.catalina.startup.Bootstrap "[email protected]" start \ >> "$CATALINA _base"/logs/catalina.out 2&1 &

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/89/3D/wKioL1gNuL3g9RIqAAA7cIjnGfQ554.png-wh_500x0-wm_3 -wmp_4-s_4131295824.png "title=" 11.png "alt=" Wkiol1gnul3g9riqaaa7cijngfq554.png-wh_50 "/>

Change the contents of the above to:

Org.apache.catalina.startup.Bootstrap "[email protected]" Start 2>&1 | /usr/local/cronolog/sbin/cronolog/log/train_interface/catalina/%y-%m-%d/catalina.%y-%m-%d-%h.out>>/dev/ Null 2>&1 &

Note: Both the upper and lower parts are changed

/usr/local/cronolog/sbin/cronolog #为cronolog安装目录

/log/train_interface/catalina/#运行会自动创建在/log Create a file below


Parameters

%H hours (expressed in 00-23).

%I Hours (expressed in 01-12).

%K hours (expressed in 0-23).

%l hours (expressed in 0-12).

%M minutes (expressed in 00-59).

%P am or PM.

%r time (including hours, minutes and seconds, hour is expressed as 12 hours am/pm).

Total number of seconds in%s. The starting time is 1970-01-01 00:00:00 UTC.

%s seconds (as represented by local idioms).

%T time (minutes and seconds, hours are expressed in 24-hour system).

%x time (expressed in local idiomatic notation).

%Z downtown.

%a abbreviation of the week.

The full name of the%A week.

Abbreviation for%b month English name.

The full English name of the%B month.

%c date and time. Entering only the date instruction will also show the same result.

%d date (expressed as 01-31).

%d Date (including month date).

%j the first day of the year.

%m month (expressed as 01-12).

%u the number of weeks in the year.

%w the number of days of the week, 0 for Sunday, 1 for Monday, once analogy.

%x date (expressed in local idiomatic notation).

%y year (expressed in 00-99).

%Y year (expressed in four digits).

%n inserts a new line when it is displayed.

%t when displayed, Insert tab.

MM month (required).

DD Date (required).

HH hour (necessary).

MM minutes (required).

SS seconds (selectivity).


Restart Service

#./catalina.sh Stop #./catalina.sh Start

Validation services

# ls/log/train_interface/catalina/

You'll create logs, and there's a few more files like Catalina.2006-06-01-*.log.

Log compression scripts See

http://pengjc.blog.51cto.com/9255463/1865026




This article is from the "willing to share with you" blog, please be sure to keep this source http://pengjc.blog.51cto.com/9255463/1865016

Tomcat Implements log segmentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.