apache定期删除日志
需要装一个cronolog的软件
wgethttp://cronolog.org/download/cronolog-1.6.2.tar.gz
tarzxvfcronolog-1.6.2.tar.gz
cdcronolog-1.6.2
./configure--prefix=/usr/local/cronolog
make&&makeinstall
3.配置
vi/usr/local/apache/conf/httpd.conf
CustomLog“|/usr/local/sbin/cronolog/usr/local/apache/logs/access_%Y%m%d.log”combined定义访问日志
ErrorLog“|/usr/local/sbin/cronolog/home/www/ex/log/error_%Y%m%d.log”定义错误日志
保存配置文件后,重新加载或重启apache服务即可生效。
servicehttpdrestart
首先要日志滚动,然后才好,定期删除。
305***/usr/bin/find/home/apache/logs/-nameaccess_log.gz-mtime+3|xargsrm-rf
相关推荐
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03
likesyour 2020-08-01