Apache的日志配置
Apache日志轮询工具cronolog
cd /home/zxin10/tools
rz
tar xf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure
make
make install
安装成功:
[root@c601 cronolog-1.6.2]# ll /usr/local/sbin/cronolog
-rwxr-xr-x 1 root root 40446 Feb 3 12:55 /usr/local/sbin/cronolog
cronolog日志轮询配置说明
[root@c601 cronolog-1.6.2]# cd /application/apache/conf/extra/
[root@c601 extra]# vi httpd-vhosts.conf
(在站点下添加如下配置)
CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined
例如:
<VirtualHost *:80>
ServerAdmin 31333741@qq.com
DocumentRoot "/var/blog"
ServerName blog.etiantian.org
ServerAlias etiantian.org
ErrorLog "logs/blog-error_log"
#CustomLog "logs/blog-access_log" common
CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined
</VirtualHost>
#创建日志轮询的目录
[root@c601 extra]# mkdir -p /app/logs
#在浏览器端访问网站,查看测试结果。
[root@c601 extra]# tail -f /app/logs/access_www_20180203.log
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
Apache日志轮询工具cronolog
cd /home/zxin10/tools
rz
tar xf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure
make
make install
安装成功:
[root@c601 cronolog-1.6.2]# ll /usr/local/sbin/cronolog
-rwxr-xr-x 1 root root 40446 Feb 3 12:55 /usr/local/sbin/cronolog
cronolog日志轮询配置说明
[root@c601 cronolog-1.6.2]# cd /application/apache/conf/extra/
[root@c601 extra]# vi httpd-vhosts.conf
(在站点下添加如下配置)
CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined
例如:
<VirtualHost *:80>
ServerAdmin 31333741@qq.com
DocumentRoot "/var/blog"
ServerName blog.etiantian.org
ServerAlias etiantian.org
ErrorLog "logs/blog-error_log"
#CustomLog "logs/blog-access_log" common
CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined
</VirtualHost>
#创建日志轮询的目录
[root@c601 extra]# mkdir -p /app/logs
#在浏览器端访问网站,查看测试结果。
[root@c601 extra]# tail -f /app/logs/access_www_20180203.log
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
192.168.0.101 - - [03/Feb/2018:13:15:20 +0800] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"