Apache cronlog installation Configuration

Source: Internet
Author: User
Tags month name

1. cronolog is a simple filter program that reads log records from standard input devices and writes these records to the output file set, the name of the output file consists of a file name template and the current date and time. Cronolog is usually used with Web servers, such as Apache, to securely split log files by date, month, or other specific intervals. 3. Install cronolog 3.1 download cronolog of the latest stable release (GA) visit cronolog website http://cronolog.org/download/index.html download the latest stable release of cronolog source package. This document uses version 1.6.2 and downloads it with the following command in Linux: wget http://cronolog.org/download/cronolog-1.6.2.tar.gz3.2 extract the downloaded source package first create a working directory (the recommended directory is/usr/local/src/cronolog ): mkdir-P/usr/local/src/cronolog move the downloaded source package to the working directory: MV cronolog-1.6.2.tar.gz/usr/local/src/cronolog to the working directory and decompress the source package using the tar command: after the CD/usr/local/src/cronologtar zxvf cronolog-1.6.2.tar.gz command is executed, a new subdirectory cronolog-1.6.2 is generated under the current working directory, which is the source file of cronolog. 3.3 configure the MAKEFILE file to enter the cronolog source code Directory: CD cronolog-1.6.2 run the following command to view configurable options :. /configure -- help the configuration command used in this article is as follows: CC = GCC cflags = "-O3 ". /configure -- prefix =/usr/local/cronolog (create the cronolog folder under local First) configuration option Description: CC: C compiler name (used to run configure ), the example in this article is the gcccflags: C compiler flag (used to run configure), the example in this article is-O3, and the optimization level is 3 -- prefix: Specifies the installation directory, in this example, compile/usr/local/cronolog3.4 and install and execute the following command to compile the source code: make runs the following command to install cronolog to the target path: Make install3.6 after the directory structure is installed, the following directories will be generated in the previously specified destination path :. /INFO cronolog information file (. info) directory. /man cronolog help file (man) directory. /sbin cronolog binary file directory The installation is complete. Test
    1. CD/usr/local/cronolog/sbin
    2. ./Cronolog-V (note that V is in uppercase)
    3. Cronolog version 1.6.2 is displayed successfully.

 

Use of cronolog Cronolog is usually called in the application configuration file as a log filter program in the form of pipelines. The direct usage is:/path/to/cronolog [Options] logfile-spec where: Options: cronolog options can be viewed through the-H or -- help options in the following example, we will not describe it here. Examples of help information obtained in this article:/usr/local/cronolog/sbin/cronolog-H or:/usr/local/cronolog/sbin/cronolog -- helplogfile-spec: is a template that describes the output log file name. Each character without leading % is a component of the file name. % is followed by a string of Date and Time formats, replaced by the actual strings listed in the following table. Special Format String: % character % N new line % t Tab character Time Format String: % H hour (00 .. 23) % I 12 hour (01 .. 12) % P local AM/PM indicator % m minutes (00 .. 59) % s seconds (00 .. 61) % x local time (e.g.: "15:12:47") % Z Time Zone (e.g. GMT). If the time zone cannot be detected, the value is an empty Date Format String: % A local short week name (e.g.: Sun .. sat) % A local full week name (e.g.: Sunday .. saturday) % B local short month name (e.g.: Jan .. dec) % B local full month name (e.g.: January .. december) % C local date and time (e.g.: "Sun Dec 15 14:12:47 GMT 1996") % d Date of January (01 .. 31) % J the day of the year (001 .. 366) % m indicates the number of months (01 .. 12) % u the number of weeks (00 .. 53. The first week includes the first Sunday of the New Year. % W. the number of weeks in a year based on Monday as the first day of the week (00 .. 53. The first week includes the first Monday of the New Year. % W indicates the number of weeks (0 .. 6, 0 is Sunday) % x local date (e.g. today in Beijing: "15/12/96") % Y does not take the year of the century (00 .. 99) % Y the year of the century (1970 .. 2038) The following is the usage in Apache: customlog "|/path/to/cronolog [Options] logfile-spec" [format] Options and logfile-spec, format is the log format parameter of the Apache mlog command configured in Apache. The following is an example of this article: Modify the Apache configuration file. The example is/usr/local/Apache-2.2.6/CONF/httpd. conf: VI, USR, local, APACHE-2.2.6, Conf, and httpd. conf: Change the customlog command as follows. In this example, change customlog logs/access_log common: customlog "|/usr/local/cronolog/sbin/cronolog/usr/local/Apache-2.2.6/logs/access_log. % Y % m % d "combined command explanation:/usr/local/cronolog/sbin/cronolog is the absolute path of the cronolog binary file/usr/local/Apache-2.2.6/logs/access_log. % Y % m % d is the template of the output log file name. The log file/usr/local/Apache-2.2.6/logs/access_log.20080301 of the file name. Combined is the format name of Apache logs. The error log is changed to errorlog "|/usr/local/cronolog/sbin/cronolog/usr/local/Apache/logs/access_log. % Y % m % d "restart Apache after modification according to your actual situation.

install and configure Apache cronlog

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.