Linux日志系统-06:案例2-实现httpd的日志滚动分割
生活随笔
收集整理的這篇文章主要介紹了
Linux日志系统-06:案例2-实现httpd的日志滚动分割
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
實(shí)現(xiàn)http的日志滾動(dòng)分割
需求
1、要求 http的日志每天滾動(dòng)一次2、日志大小達(dá)到100M的時(shí)候也觸發(fā)滾動(dòng)3、日志滾動(dòng)的后綴為當(dāng)前日期時(shí)間4、滾動(dòng)的日志壓縮存放5、保留15個(gè)日志副本6、創(chuàng)建新的日志文件PS:httpd日志文件位置:/var/log/httpd/access_log實(shí)現(xiàn)步驟
1、創(chuàng)建httpd的滾動(dòng)配置文件
# vim /etc/logrotate.d/httpd/var/log/httpd/*log { # missingok # notifempty # sharedscripts # delaycompress # postrotate # /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true # endscriptdailysize 100Mcompressdateextrotate 15create 0644 root root}2、測(cè)試
logrotate -f /etc/logrotate.d/httpd -d:顯示執(zhí)行過程-f:強(qiáng)制啟動(dòng)logrotate-s:使用指定的狀態(tài)文件總結(jié)
以上是生活随笔為你收集整理的Linux日志系统-06:案例2-实现httpd的日志滚动分割的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux日志系统-05:案例1-实现临
- 下一篇: Linux日志系统-07:案例3-rsy