欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos 7.6——Apache日志分割(rotatelogs 分割工具、cronolog分割工具)

程序员文章站 2022-06-25 21:46:20
...

centos 7.6——Apache日志分割

rotatelogs 分割工具

[aaa@qq.com opt]# yum -y install httpd
[aaa@qq.com opt]#which rotatelogs
/usr/sbin/rotatelogs

[aaa@qq.com opt]#cd /etc/httpd/conf/
[aaa@qq.com httpd]# vim httpd.conf
ServerName www.kgc.com:80
Listen 192.168.75.134:80
#Listen 80
ErrorLog "| /usr/sbin/rotatelogs -l logs/www.kgc.com-error_%Y%m%d.log 86400"
CustomLog "|/usr/sbin/rotatelogs -l logs/www.kgc.com-access_%Y%m%d.log 86400" combined
[aaa@qq.com httpd]#iptables -F
[aaa@qq.com httpd]#setenforce 0
[aaa@qq.com httpd]# systemctl restart httpd
[aaa@qq.com httpd]# cd /var/log/httpd

[aaa@qq.com httpd]# ll
总用量 20
-rw-r--r--. 1 root root 7395 85 15:35 access_log
-rw-r--r--. 1 root root 4504 85 15:39 www.kgc.com-access_20200805.log
-rw-r--r--. 1 root root 2642 85 15:40 www.kgc.com-error_20200805.log

centos 7.6——Apache日志分割(rotatelogs 分割工具、cronolog分割工具)

cronolog分割工具


[aaa@qq.com opt]# ll
总用量 36
-rw-r--r--. 1 root root 36764 85 14:48 cronolog-1.6.2-14.el7.x86_64.rpm
drwxr-xr-x. 2 root root     6 1031 2018 rh
[aaa@qq.com opt]# rpm -ivh cronolog-1.6.2-14.el7.x86_64.rpm 
警告:cronolog-1.6.2-14.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, ** ID 352c64e5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:cronolog-1.6.2-14.el7            ################################# [100%]

[aaa@qq.com opt]# cd /etc/httpd/conf/
[aaa@qq.com conf]# vim httpd.conf 
[aaa@qq.com conf]# which cronolog
/usr/sbin/cronolog
[aaa@qq.com conf]# vim httpd.conf

ServerName www.kgc.com:80
Listen 192.168.75.134:80
#Listen 80
ErrorLog "| /usr/sbin/cronolog  logs/www.kgc.com-error_%Y%m%d.log "

ErrorLog "| /usr/sbin/cronolog  logs/www.kgc.com-error_%Y%m%d.log "
[aaa@qq.com conf]#cd /var/log/httpd
[aaa@qq.com conf]#systemctl restart httpd
[aaa@qq.com httpd]# ll
总用量 16
-rw-r--r--. 1 root root 7395 85 15:35 access_log
-rw-r--r--. 1 root root 2418 85 17:33 www.kgc.com-access_20200805.log
-rw-r--r--. 1 root root 2642 85 17:33 www.kgc.com-error_20200805.log


centos 7.6——Apache日志分割(rotatelogs 分割工具、cronolog分割工具)

相关标签: web——群集