专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »web服务器 » 打开安装日志文件:安装cronolog格式化Apache的日志文件 »正文

打开安装日志文件:安装cronolog格式化Apache的日志文件

来源: 发布时间:星期日, 2009年1月4日 浏览:7次 评论:0
使用cronolog可以格式化apache配置文件

以下是我安装日志供大家参考:
[root@eygle opt]# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
--08:05:12--  http://cronolog.org/download/cronolog-1.6.2.tar.gz
=> `cronolog-1.6.2.tar.gz'
Resolving cronolog.org... done.
Connecting to cronolog.org[217.160.212.212]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 133,591 [application/x-gzip]

100%[>] 133,591       26.23K/s    ETA 00:00

08:05:19 (26.23 KB/s) - `cronolog-1.6.2.tar.gz' saved [133591/133591]
[root@eygle opt]# gzip -d cronolog-1.6.2.tar.gz
[root@eygle opt]# tar xf cronolog-1.6.2.tar
[root@eygle opt]# cd cronolog-1.6.2
[root@eygle cronolog-1.6.2]# ls
aclocal.m4  config.cache   configure     cronolog.spec  -sh  Makefile.am  mkdirs  src
AUTHORS     config.log     configure.in  doc            lib         Makefile.in  NEWS           testsuite
ChangeLog   config.status  COPYING       INSTALL        Makefile    missing      README         TODO
[root@eygle cronolog-1.6.2]# ./configure
loading cache ./config.cache
checking for a BSD compatible ... (cached) /usr/bin/ -c
checking whether build environment is sane... yes
checking whether make s ${MAKE}... (cached) yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible ... /usr/bin/ -c
checking whether ln -s works... (cached) yes
checking for ranlib... (cached) ranlib
checking for perl... (cached) /usr/bin/perl
checking how to run the C preprocessor... (cached) gcc -E
checking for ANSI C header files... (cached) yes
checking whether stat file-mode macros are broken... (cached) no
checking whether time.h and sys/time.h may both be d... (cached) yes
checking whether struct tm is in sys/time.h or time.h... (cached) time.h
checking for tm_zone in struct tm... (cached) yes
checking for fcntl.h... (cached) yes
checking for limits.h... (cached) yes
checking for unistd.h... (cached) yes
checking for working const... (cached) yes
checking for size_t... (cached) yes
checking whether struct tm is in sys/time.h or time.h... (cached) time.h
checking for strftime... (cached) yes
checking for vprf... (cached) yes
checking for mkdir... (cached) yes
checking for mktime... (cached) yes
checking for putenv... (cached) yes
checking for strptime... (cached) yes
checking for localtime_r... (cached) yes
creating ./config.status
creating Makefile
creating lib/Makefile
creating src/Makefile
creating doc/Makefile
creating testsuite/Makefile
creating src/cronosplit
[root@eygle cronolog-1.6.2]# make
Making all in lib
make[1]: Entering directory `/opt/cronolog-1.6.2/lib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/cronolog-1.6.2/lib'
Making all in src
make[1]: Entering directory `/opt/cronolog-1.6.2/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/cronolog-1.6.2/src'
Making all in doc
make[1]: Entering directory `/opt/cronolog-1.6.2/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/cronolog-1.6.2/doc'
Making all in testsuite
make[1]: Entering directory `/opt/cronolog-1.6.2/testsuite'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/cronolog-1.6.2/testsuite'
make[1]: Entering directory `/opt/cronolog-1.6.2'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/opt/cronolog-1.6.2'
[root@eygle cronolog-1.6.2]# make
Making in lib
make[1]: Entering directory `/opt/cronolog-1.6.2/lib'
make[2]: Entering directory `/opt/cronolog-1.6.2/lib'
make[2]: Nothing to be done for `-exec-am'.
make[2]: Nothing to be done for `-data-am'.
make[2]: Leaving directory `/opt/cronolog-1.6.2/lib'
make[1]: Leaving directory `/opt/cronolog-1.6.2/lib'
Making in src
make[1]: Entering directory `/opt/cronolog-1.6.2/src'
make[2]: Entering directory `/opt/cronolog-1.6.2/src'
/bin/sh ../mkdirs /usr/local/sbin
/usr/bin/ -c  cronolog /usr/local/sbin/cronolog
/bin/sh ../mkdirs /usr/local/sbin
/usr/bin/ -c  cronosplit /usr/local/sbin/cronosplit
make[2]: Nothing to be done for `-data-am'.
make[2]: Leaving directory `/opt/cronolog-1.6.2/src'
make[1]: Leaving directory `/opt/cronolog-1.6.2/src'
Making in doc
make[1]: Entering directory `/opt/cronolog-1.6.2/doc'
make[2]: Entering directory `/opt/cronolog-1.6.2/doc'
make[2]: Nothing to be done for `-exec-am'.
/bin/sh ../mkdirs /usr/local/info
/usr/bin/ -c -m 644 ./cronolog.info /usr/local/info/cronolog.info
-info --info-dir=/usr/local/info /usr/local/info/cronolog.info
make  -man1
make[3]: Entering directory `/opt/cronolog-1.6.2/doc'
/bin/sh ../mkdirs /usr/local/man/man1
/usr/bin/ -c -m 644 ./cronolog.1m /usr/local/man/man1/cronolog.1m
/usr/bin/ -c -m 644 ./cronosplit.1m /usr/local/man/man1/cronosplit.1m
make[3]: Leaving directory `/opt/cronolog-1.6.2/doc'
make[2]: Leaving directory `/opt/cronolog-1.6.2/doc'
make[1]: Leaving directory `/opt/cronolog-1.6.2/doc'
Making in testsuite
make[1]: Entering directory `/opt/cronolog-1.6.2/testsuite'
make[2]: Entering directory `/opt/cronolog-1.6.2/testsuite'
make[2]: Nothing to be done for `-exec-am'.
make[2]: Nothing to be done for `-data-am'.
make[2]: Leaving directory `/opt/cronolog-1.6.2/testsuite'
make[1]: Leaving directory `/opt/cronolog-1.6.2/testsuite'
make[1]: Entering directory `/opt/cronolog-1.6.2'
make[2]: Entering directory `/opt/cronolog-1.6.2'
make[2]: Nothing to be done for `-exec-am'.
make[2]: Nothing to be done for `-data-am'.
make[2]: Leaving directory `/opt/cronolog-1.6.2'
make[1]: Leaving directory `/opt/cronolog-1.6.2'
[root@eygle cronolog-1.6.2]# which cronolog
/usr/local/sbin/cronolog





安装完成以后需要对apache进行适当配置修改httpd.conf文件主要注意以下几点:

1.自定义日志格式

CustomLog "|/usr/local/sbin/cronolog /opt/apache/logs/access_log.%Y%m%d" combined

2.如果存在多个虚拟站点

可以考虑在VirtualHost进行相应设置
ServerAdmin [email protected]
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common



www.eygle.com存在多个子站点但是都使用了同个日志文件配置后生成日志文件效果:

[root@eygle logs]# ls -l access_log.20041226
-rw-r--r--    1 root     root       110425 Dec 26 09:10 access_log.20041226




0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: