\u8fd9\u6837\u5c31\u53ef\u4ee5\u6bcf\u5929\u751f\u6210\u4e00\u4e2a\u4ee5\u65e5\u671f\u548c\u65f6\u95f4\u547d\u540d\u7684\u65b0\u7684access.log\u6587\u4ef6linux\u6587\u672c\u7f16\u8f91\u5668\uff0c\u5e76\u5c06\u65e7\u7684access.log\u6587\u4ef6\u5f52\u6863\u3002<\/p>\n
\u9664\u4e86\u5207\u5272\u548c\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\u5916\uff0crotatelogs\u8fd8\u652f\u6301\u5408\u5e76\u591a\u4e2a\u65e5\u5fd7\u6d41\u8f93\u51fa\u5230\u540c\u4e00\u4e2a\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u5408\u5e76\u6765\u81ea\u4e24\u4e2a\u4e0d\u540c\u8fdb\u7a0b\u7684\u65e5\u5fd7\u6d41\uff1a<\/p>\n
\nrotatelogs -M\/var\/log\/access.log 86400\n<\/pre>\n<\/p>\n\u8fd9\u6837\u5c31\u53ef\u4ee5\u5c06\u4e24\u4e2a\u8fdb\u7a0b\u7684\u65e5\u5fd7\u5408\u5e76\u8f93\u51fa\u5230\u540c\u4e00\u4e2aaccess.log\u6587\u4ef6\u4e2d\u3002<\/p>\n
8. rotatelogs\u547d\u4ee4\u7684\u9ad8\u7ea7\u7528\u6cd5\uff1a\u81ea\u5b9a\u4e49\u65e5\u5fd7\u5207\u5272\u6761\u4ef6<\/p>\n
\u901a\u8fc7\u4f7f\u7528\u81ea\u5b9a\u4e49\u811a\u672c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u7075\u6d3b\u7684\u65e5\u5fd7\u5207\u5272\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u901a\u8fc7\u81ea\u5b9a\u4e49\u811a\u672c\u6765\u5224\u65ad\u662f\u5426\u9700\u8981\u5207\u5272\u65e5\u5fd7\uff1a<\/p>\n
\n
\nrotatelogs -l\/var\/log\/access.log \/path\/to\/script\n<\/pre>\n<\/p>\n\u5728\u811a\u672c\u4e2d\u53ef\u4ee5\u7f16\u5199\u903b\u8f91\u6765\u5224\u65ad\u662f\u5426\u9700\u8981\u5207\u5272\u65e5\u5fd7\uff0c\u5e76\u8fd4\u56de\u76f8\u5e94\u7684\u7ed3\u679c\u3002<\/p>\n
9. rotatelogs\u547d\u4ee4\u7684\u9ad8\u7ea7\u7528\u6cd5\uff1a\u7ed3\u5408\u5176\u4ed6\u5de5\u5177\u5b9e\u73b0\u66f4\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u529f\u80fd<\/p>\n
\u9664\u4e86\u5355\u72ec\u4f7f\u7528rotatelogs\u547d\u4ee4\u5916\uff0c\u8fd8\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6\u5de5\u5177\u6765\u5b9e\u73b0\u66f4\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528logrotate\u5de5\u5177\u6765\u5b9a\u671f\u6e05\u7406\u548c\u538b\u7f29\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n
10. rotatelogs\u547d\u4ee4\u7684\u6ce8\u610f\u4e8b\u9879\u548c\u5e38\u89c1\u95ee\u9898\u89e3\u7b54<\/b><\/p>\n
\u5728\u4f7f\u7528rotatelogs\u547d\u4ee4\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n
-\u786e\u4fdd\u8f93\u51fa\u8def\u5f84\u53ef\u5199\uff1a\u786e\u4fdd\u6307\u5b9a\u7684\u8f93\u51fa\u8def\u5f84\u6709\u8db3\u591f\u7684\u6743\u9650\u8fdb\u884c\u5199\u64cd\u4f5c\u3002<\/p>\n
-\u907f\u514d\u6587\u4ef6\u540d\u91cd\u590d\uff1a\u5982\u679c\u591a\u4e2a\u8fdb\u7a0b\u540c\u65f6\u4f7f\u7528\u76f8\u540c\u7684\u8f93\u51fa\u8def\u5f84\u548c\u6587\u4ef6\u540d\u683c\u5f0f\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6587\u4ef6\u540d\u91cd\u590d\uff0c\u9700\u8981\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n
-\u5b9a\u671f\u6e05\u7406\u5f52\u6863\u6587\u4ef6\uff1a\u5b9a\u671f\u6e05\u7406\u4e0d\u518d\u9700\u8981\u7684\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\uff0c\u4ee5\u91ca\u653e\u78c1\u76d8\u7a7a\u95f4\u3002<\/p>\n
\u4ee5\u4e0a\u662f\u5173\u4e8e\u5982\u4f55\u4f7f\u7528linux rotatelogs<\/strong>\u547d\u4ee4\u5b9e\u73b0\u65e5\u5fd7\u5207\u5272\u548c\u5f52\u6863\u7684\u4ecb\u7ecd\u3002\u901a\u8fc7\u5408\u7406\u914d\u7f6erotatelogs\u547d\u4ee4\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406\u548c\u67e5\u9605\u65e5\u5fd7\u6587\u4ef6\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7a33\u5b9a\u6027\u548c\u6545\u969c\u6392\u67e5\u6548\u7387\u3002\u5e0c\u671b\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"linux rotatelogsrotatelogs\u547d\u4ee4\u7684\u9ad8\u7ea7\u7528\u6cd5\uff1a\u7ed3\u5408\u5176\u4ed6\u5de5\u5177\u5b9e\u73b0\u66f4\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u529f\u80fd\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528linux\u7cfb\u7edf\u4e2d\u7684rotatelogs\u547d\u4ee4\u6765\u5b9e\u73b0\u65e5\u5fd7\u5207\u5272\u548c\u5f52\u6863\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u547d\u4ee4\u5c06\u901a\u8fc7\u81ea\u5b9a\u4e49\u811a\u672c\u6765\u5224\u65ad\u662f\u5426\u9700\u8981\u5207\u5272\u65e5\u5fd7\uff1a\u5728\u811a\u672c\u4e2d\u53ef\u4ee5\u7f16\u5199\u903b\u8f91\u6765\u5224\u65ad\u662f\u5426\u9700\u8981\u5207\u5272\u65e5\u5fd7\uff0c\u5e76\u8fd4\u56de\u76f8\u5e94\u7684\u7ed3\u679c\u3002rotatelogs\u547d\u4ee4\u7684\u9ad8\u7ea7\u7528\u6cd5\uff1a\u7ed3\u5408\u5176\u4ed6\u5de5\u5177\u5b9e\u73b0\u66f4\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u529f\u80fd<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-287935","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/287935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=287935"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/287935\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=287935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=287935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=287935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}