【CentOS7架构11】,访问日志切割#171221
hellopasswd
创新互联是一家集网站建设,石柱土家族企业网站建设,石柱土家族品牌网站建设,网站定制,石柱土家族网站建设报价,网络营销,网络优化,石柱土家族网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。访问日志切割 日志一直记录总有一天会把整个磁盘占满,所以有必要设置自动切割,并删除旧的日志文件 把虚拟主机配置文件改成如下:
[root@localhost 111.com]# vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf 44
-l以当前系统切割日志,若不指定以UTC切割,国内为CST,差几个时区 按天记录,换算为秒为86400s
[root@localhost 111.com]# /usr/local/apache2.4/bin/apachectl -t Syntax OK [root@localhost 111.com]# /usr/local/apache2.4/bin/apachectl graceful [root@localhost 111.com]# ls /usr/local/apache2.4/logs/ 111.com-access_log abc.com-access_log access_log httpd.pid 111.com-error_log abc.com-error_log error_log [root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/index.php hello!111.com
[root@localhost 111.com]# cat /usr/local/apache2.4/logs/111.com-access_20171104.log 127.0.0.1 - - [04/Nov/2017:22:30:22 +0800] "GET HTTP://111.com/index.php HTTP/1.1" 200 13 "-" "curl/7.29.0 [root@localhost 111.com]# ls /usr/local/apache2.4/logs/ 111.com-access_20171104.log 111.com-error_log abc.com-error_log error_log 111.com-access_log abc.com-access_log access_log httpd.pid
[root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/1111.png -I HTTP/1.1 200 OK Date: Sat, 04 Nov 2017 14:35:19 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Last-Modified: Sat, 04 Nov 2017 14:35:19 GMT ETag: W/"99ad-560d9271dfe00" Accept-Ranges: bytes Content-Length: 39341 Content-Type: image/png [root@localhost 111.com]# curl -x 127.0.0.1:80 111.com/1111.png1 -I HTTP/1.1 404 Not Found Date: Sat, 04 Nov 2017 14:35:24 GMT Server: Apache/2.4.29 (Unix) PHP/5.6.30 Content-Type: text/html; charset=iso-8859-1 [root@localhost 111.com]# cat /usr/local/apache2.4/logs/111.com-access_20171104.log 127.0.0.1 - - [04/Nov/2017:22:30:22 +0800] "GET HTTP://111.com/index.php HTTP/1.1" 200 13 "-" "curl/7.29.0" 127.0.0.1 - - [04/Nov/2017:22:35:24 +0800] "HEAD HTTP://111.com/1111.png1 HTTP/1.1" 404 - "-" "curl/7.29.0
修改与 171221
分享文章:【CentOS7架构11】,访问日志切割#171221
URL标题:http://azwzsj.com/article/cjjeij.html