apache日志切割工具cronolog安装配置
apache日志切割工具cronolog安装配置
linux环境 centos 6.7 cronolog版本 cronolog-1.6.2
安装cronolog
下载好安装包(https://files.cnblogs.com/files/crazyzero/cronolog-1.6.2.tar.gz)
[root@zero tools]# wget https://files.cnblogs.com/files/crazyzero/cronolog-1.6.2.tar.gz
[root@zero tools]# ll cronolog-1.6.2.tar.gz
-rw-r--r-- 1 root root 133591 8月 25 2017 cronolog-1.6.2.tar.gz
减压并进入
[root@zero tools]# tar xf cronolog-1.6.2.tar.gz
[root@zero tools]# cd cronolog-1.6.2
编译安装
[root@zero cronolog-1.6.2]# ./configure
[root@zero cronolog-1.6.2]# make
[root@zero cronolog-1.6.2]# make install
生成cronolog工具
[root@zero cronolog-1.6.2]# ll /usr/local/sbin/cronolog
-rwxr-xr-x 1 root root 40446 8月 11 11:55 /usr/local/sbin/cronolog
cronolog语法
CustomLog "|/usr/local/sbin/cronolog /web/apache/logs/roth-access_%Y%m%d.log"
实际使用
<VirtualHost *:80>
ServerAdmin 690679372@qq.com
DocumentRoot "/var/html/roth"
ServerName www.roth.com
ErrorLog "logs/roth-error_log"
CustomLog "|/usr/local/sbin/cronolog /web/apache/logs/roth-access_%Y%m%d.log" common
</VirtualHost>