{"id":82450,"date":"2026-07-25T09:11:03","date_gmt":"2026-07-25T01:11:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/82450.html"},"modified":"2026-07-25T09:11:03","modified_gmt":"2026-07-25T01:11:03","slug":"%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5%ef%bc%9alogrotate%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3%e3%80%81%e4%ba%91%e6%97%a5%e5%bf%97%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/82450.html","title":{"rendered":"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848"},"content":{"rendered":"<p>\u3010\u6458\u8981\u3011<br \/>\n\u670d\u52a1\u5668\u65e5\u5fd7\u6587\u4ef6\u65e0\u9650\u589e\u957f\u5bfc\u81f4\u78c1\u76d8\u5199\u6ee1&#xff0c;\u662f\u8fd0\u7ef4\u4e2d\u7684\u5e38\u89c1\u6545\u969c\u3002\u672c\u6587\u4ece\u5b9e\u6218\u89d2\u5ea6\u51fa\u53d1&#xff0c;\u4ecb\u7ecd\u4e09\u79cd\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848&#xff1a;\u57fa\u4e8eLinux logrotate\u7684\u672c\u5730\u65e5\u5fd7\u8f6e\u8f6c\u3001ELK\u6280\u672f\u6808\u7684\u9002\u7528\u6027\u8bc4\u4f30\u3001\u4ee5\u53ca\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1&#xff08;SLS\/CLS\/CloudWatch&#xff09;\u7684\u63a5\u5165\u4e0e\u6210\u672c\u5206\u6790\u3002\u540c\u65f6\u9488\u5bf9Docker\u5bb9\u5668\u7684\u65e5\u5fd7\u81a8\u80c0\u95ee\u9898\u63d0\u4f9b\u914d\u7f6e\u793a\u4f8b&#xff0c;\u5e76\u7ed9\u51fa\u65e5\u5fd7\u544a\u8b66\u89c4\u5219\u8bbe\u8ba1\u601d\u8def\u3002<\/p>\n<p>\u5173\u952e\u8bcd&#xff1a;\u00a0\u65e5\u5fd7\u7ba1\u7406, logrotate, \u4e91\u65e5\u5fd7\u670d\u52a1, Docker\u65e5\u5fd7, \u65e5\u5fd7\u544a\u8b66, SLS<\/p>\n<hr \/>\n<h3>\u4e00\u3001 \u95ee\u9898\u80cc\u666f<\/h3>\n<p>\u5728\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;Nginx\u7684access.log\u3001\u5e94\u7528\u670d\u52a1\u7684stdout\u8f93\u51fa\u82e5\u4e0d\u52a0\u4ee5\u63a7\u5236&#xff0c;\u5c06\u5728\u6570\u6708\u5185\u5360\u7528\u6570\u5341GB\u78c1\u76d8\u7a7a\u95f4&#xff0c;\u5bfc\u81f4\u670d\u52a1\u5668\u56e0\u78c1\u76d8\u6ee1\u800c\u62d2\u7edd\u670d\u52a1\u3002<\/p>\n<p>\u7b14\u8005\u66fe\u4e24\u6b21\u906d\u9047\u56e0\u65e5\u5fd7\u6587\u4ef6\u5bfc\u81f4\u7684\u78c1\u76d8\u5199\u6ee1\u6545\u969c&#xff1a;<\/p>\n<li>\n<p>Nginx\u65e5\u5fd7\u534a\u5e74\u672a\u8f6e\u8f6c&#xff0c;\u5355\u6587\u4ef6\u8fbe40GB\u3002<\/p>\n<\/li>\n<li>\n<p>Node.js\u5e94\u7528\u8c03\u8bd5\u65e5\u5fd7\u672a\u5173\u95ed&#xff0c;\u65e5\u589e20GB\u3002<\/p>\n<\/li>\n<p>\u4ee5\u4e0b\u4ece\u672c\u5730\u8f6e\u8f6c\u3001\u96c6\u4e2d\u5f0f\u5e73\u53f0\u3001\u4e91\u539f\u751f\u670d\u52a1\u4e09\u4e2a\u7ef4\u5ea6\u7ed9\u51fa\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h3>\u4e8c\u3001 \u65b9\u6848\u4e00&#xff1a;logrotate\u672c\u5730\u65e5\u5fd7\u8f6e\u8f6c<\/h3>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u00a0\u670d\u52a1\u5668\u6570\u91cf\u22643\u53f0&#xff0c;\u65e5\u5fd7\u4ec5\u9700\u672c\u5730\u7559\u5b58&#xff0c;\u65e0\u9700\u96c6\u4e2d\u68c0\u7d22\u3002<\/p>\n<p>2.1 logrotate\u7b80\u4ecb<br \/>\nlogrotate\u662fLinux\u7cfb\u7edf\u81ea\u5e26\u7684\u65e5\u5fd7\u7ba1\u7406\u5de5\u5177&#xff0c;\u901a\u8fc7cron\u5b9a\u65f6\u4efb\u52a1\u6267\u884c&#xff0c;\u652f\u6301\u65e5\u5fd7\u7684\u5b9a\u671f\u5207\u5272\u3001\u538b\u7f29\u3001\u5220\u9664\u4e0e\u5f52\u6863\u540e\u52a8\u4f5c\u3002<\/p>\n<p>2.2 Nginx\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u793a\u4f8b<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u8def\u5f84&#xff1a;\/etc\/logrotate.d\/nginx<\/p>\n<p>text<\/p>\n<p>\/var\/log\/nginx\/*.log {<br \/>\n    daily                    # \u6bcf\u65e5\u8f6e\u8f6c<br \/>\n    rotate 7                 # \u4fdd\u75597\u4e2a\u5386\u53f2\u6587\u4ef6<br \/>\n    compress                 # \u538b\u7f29\u8f6e\u8f6c\u540e\u7684\u6587\u4ef6<br \/>\n    delaycompress            # \u5ef6\u8fdf\u4e00\u4e2a\u5468\u671f\u538b\u7f29<br \/>\n    missingok                # \u65e5\u5fd7\u7f3a\u5931\u4e0d\u62a5\u9519<br \/>\n    notifempty               # \u7a7a\u6587\u4ef6\u4e0d\u8f6e\u8f6c<br \/>\n    create 0640 nginx adm    # \u521b\u5efa\u65b0\u65e5\u5fd7\u6587\u4ef6\u53ca\u6743\u9650<br \/>\n    sharedscripts<br \/>\n    postrotate<br \/>\n        # \u5411Nginx\u4e3b\u8fdb\u7a0b\u53d1\u9001USR1\u4fe1\u53f7&#xff0c;\u4f7f\u5176\u91cd\u65b0\u6253\u5f00\u65e5\u5fd7\u6587\u4ef6<br \/>\n        [ -f \/var\/run\/nginx.pid ] &amp;&amp; kill -USR1 &#096;cat \/var\/run\/nginx.pid&#096;<br \/>\n    endscript<br \/>\n}<\/p>\n<p>2.3 \u81ea\u5b9a\u4e49\u5e94\u7528\u65e5\u5fd7\u8f6e\u8f6c<\/p>\n<p>\u82e5\u5e94\u7528\u81ea\u884c\u5199\u5165\u65e5\u5fd7\u6587\u4ef6&#xff08;\u5982\/var\/log\/myapp\/app.log&#xff09;&#xff0c;\u4ec5\u9700\u521b\u5efa\u5bf9\u5e94\u7684logrotate\u914d\u7f6e\u6587\u4ef6&#xff0c;\u6307\u5b9a\u8def\u5f84\u5373\u53ef\u3002postrotate\u90e8\u5206\u53ef\u6309\u9700\u914d\u7f6e\u5e94\u7528\u7684\u91cd\u8f7d\u6307\u4ee4\u3002<\/p>\n<p>\u4f18\u7f3a\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f18\u70b9&#xff1a;\u96f6\u4f9d\u8d56&#xff0c;\u7cfb\u7edf\u81ea\u5e26&#xff0c;\u914d\u7f6e\u7b80\u5355\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u70b9&#xff1a;\u65e5\u5fd7\u5b58\u50a8\u4e8e\u672c\u5730&#xff0c;\u670d\u52a1\u5668\u6545\u969c\u65f6\u65e5\u5fd7\u4e22\u5931&#xff1b;\u591a\u670d\u52a1\u5668\u73af\u5883\u4e0b\u9700\u9010\u53f0\u767b\u5f55\u68c0\u7d22\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e09\u3001 \u65b9\u6848\u4e8c&#xff1a;ELK\u6280\u672f\u6808\u7684\u9002\u7528\u6027\u8bc4\u4f30<\/h3>\n<p>ELK&#xff08;Elasticsearch &#043; Logstash &#043; Kibana&#xff09;\u662f\u4e1a\u754c\u901a\u7528\u7684\u96c6\u4e2d\u5f0f\u65e5\u5fd7\u5206\u6790\u5e73\u53f0\u3002<\/p>\n<table>\n<tr>\u7ec4\u4ef6\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>Elasticsearch<\/td>\n<td>\u65e5\u5fd7\u6570\u636e\u5b58\u50a8\u4e0e\u5168\u6587\u68c0\u7d22<\/td>\n<\/tr>\n<tr>\n<td>Logstash<\/td>\n<td>\u65e5\u5fd7\u91c7\u96c6\u3001\u8fc7\u6ee4\u3001\u8f6c\u6362\u7ba1\u9053<\/td>\n<\/tr>\n<tr>\n<td>Kibana<\/td>\n<td>\u53ef\u89c6\u5316\u4eea\u8868\u76d8\u4e0e\u67e5\u8be2\u754c\u9762<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9e\u6d4b\u7ed3\u8bba&#xff1a;\u4e0d\u9002\u5408\u4e2a\u4eba\u5f00\u53d1\u8005\u53ca\u5c0f\u89c4\u6a21\u56e2\u961f\u3002<\/p>\n<p>\u539f\u56e0\u5206\u6790&#xff1a;<\/p>\n<li>\n<p>\u8d44\u6e90\u5360\u7528\u8fc7\u9ad8&#xff1a;\u00a0\u6700\u4f4e\u914d\u7f6e\u5efa\u8bae2\u68384GB\u5185\u5b58&#xff0c;ES\u8fdb\u7a0b\u672c\u8eab\u5360\u7528\u8f83\u5927\u5806\u5185\u5b58\u3002<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u7ef4\u590d\u6742\u5ea6&#xff1a;\u00a0Logstash\u914d\u7f6e\u8bed\u6cd5\u590d\u6742&#xff0c;\u9700\u7f16\u5199\u6b63\u5219\u89e3\u6790\u89c4\u5219&#xff1b;ES\u96c6\u7fa4\u9700\u5173\u6ce8\u5206\u7247\u72b6\u6001\u4e0e\u78c1\u76d8\u6c34\u4f4d\u3002<\/p>\n<\/li>\n<li>\n<p>\u6210\u672c\u6548\u76ca\u5931\u8861&#xff1a;\u00a0\u7ba1\u7406\u4e0d\u8db310\u53f0\u670d\u52a1\u5668\u7684\u65e5\u5fd7\u65f6&#xff0c;\u7ef4\u62a4ELK\u6295\u5165\u7684\u65f6\u95f4\u8fdc\u8d85\u5176\u5e26\u6765\u7684\u6536\u76ca\u3002<\/p>\n<\/li>\n<p>\u66ff\u4ee3\u5efa\u8bae&#xff1a;\u00a0\u89c4\u6a21\u8fbe\u523010\u53f0\u4ee5\u4e0a\u670d\u52a1\u5668\u4e14\u9700\u8981\u8de8\u670d\u52a1\u94fe\u8def\u8ffd\u8e2a\u65f6&#xff0c;\u518d\u8bc4\u4f30ELK\u6216\u7c7b\u4f3c\u65b9\u6848\u3002<\/p>\n<h3>\u56db\u3001 \u65b9\u6848\u4e09&#xff1a;\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1<\/h3>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u00a0\u670d\u52a1\u5668\u6570\u91cf\u22653\u53f0&#xff0c;\u6216\u671f\u671b\u514d\u8fd0\u7ef4\u3001\u5177\u5907\u96c6\u4e2d\u68c0\u7d22\u4e0e\u544a\u8b66\u80fd\u529b\u3002<\/p>\n<p>4.1 \u4e3b\u6d41\u670d\u52a1\u5bf9\u7167<\/p>\n<table>\n<tr>\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1\u540d\u79f0\u63a5\u5165\u65b9\u5f0f<\/tr>\n<tbody>\n<tr>\n<td>\u963f\u91cc\u4e91<\/td>\n<td>SLS&#xff08;\u65e5\u5fd7\u670d\u52a1&#xff09;<\/td>\n<td>Logtail Agent<\/td>\n<\/tr>\n<tr>\n<td>\u817e\u8baf\u4e91<\/td>\n<td>CLS&#xff08;\u65e5\u5fd7\u670d\u52a1&#xff09;<\/td>\n<td>LogListener Agent<\/td>\n<\/tr>\n<tr>\n<td>AWS<\/td>\n<td>CloudWatch Logs<\/td>\n<td>CloudWatch Agent<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>4.2 \u63a5\u5165\u6d41\u7a0b<\/p>\n<li>\n<p>\u5728\u4e91\u63a7\u5236\u53f0\u521b\u5efa\u65e5\u5fd7\u9879\u76ee&#xff08;Project&#xff09;\u4e0e\u65e5\u5fd7\u5e93&#xff08;Logstore&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728\u670d\u52a1\u5668\u5b89\u88c5Agent&#xff08;\u4e00\u884cShell\u547d\u4ee4&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u91c7\u96c6\u89c4\u5219&#xff08;\u6307\u5b9a\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\u3001\u89e3\u6790\u6a21\u5f0f&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u65e5\u5fd7\u81ea\u52a8\u4e0a\u62a5&#xff0c;\u652f\u6301\u63a7\u5236\u53f0\u68c0\u7d22\u3001SQL\u5206\u6790\u3001\u4eea\u8868\u76d8\u5c55\u793a\u3002<\/p>\n<\/li>\n<p>4.3 \u6210\u672c\u4f30\u7b97<br \/>\n\u4ee5\u963f\u91cc\u4e91SLS\u4e3a\u4f8b&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5199\u5165\u6d41\u91cf&#xff1a;\u00a50.18\/GB<\/p>\n<\/li>\n<li>\n<p>\u5b58\u50a8\u8d39\u7528&#xff1a;\u00a50.01\/GB\/\u5929<\/p>\n<\/li>\n<li>\n<p>\u7d22\u5f15\u6d41\u91cf&#xff1a;\u00a50.35\/GB&#xff08;\u53ef\u9009&#xff0c;\u7528\u4e8e\u5feb\u901f\u68c0\u7d22&#xff09;<\/p>\n<\/li>\n<\/ul>\n<p>\u65e5\u589e200MB\u65e5\u5fd7\u7684\u7ad9\u70b9&#xff0c;\u6708\u5747\u8d39\u7528\u4f4e\u4e8e\u00a510\u3002<\/p>\n<p>4.4 \u65e5\u5fd7\u544a\u8b66\u914d\u7f6e\u793a\u4f8b<\/p>\n<p>\u53ef\u5728SLS\u63a7\u5236\u53f0\u8bbe\u7f6e\u544a\u8b66\u89c4\u5219&#xff0c;\u89e6\u53d1\u540e\u901a\u8fc7Webhook\u63a8\u9001\u81f3\u9489\u9489\/\u4f01\u4e1a\u5fae\u4fe1\u3002<\/p>\n<p>\u63a8\u8350\u914d\u7f6e\u9879&#xff1a;<\/p>\n<ul>\n<li>\n<p>ERROR\u7ea7\u522b\u65e5\u5fd7\u9891\u7387\u544a\u8b66&#xff1a;\u00a0level&#061;ERROR | count &gt; 5 per minute<\/p>\n<\/li>\n<li>\n<p>404\u72b6\u6001\u7801\u7a81\u589e\u544a\u8b66&#xff1a;\u00a0status&#061;404 | count &gt; 20 per minute<\/p>\n<\/li>\n<li>\n<p>\u6162\u8bf7\u6c42\u544a\u8b66&#xff1a;\u00a0request_time &gt; 3<\/p>\n<\/li>\n<\/ul>\n<p>\u9489\u9489\u673a\u5668\u4ebaWebhook\u63a5\u5165\u514d\u8d39&#xff0c;\u5b9e\u73b0\u6545\u969c\u5b9e\u65f6\u611f\u77e5\u3002<\/p>\n<h3>\u4e94\u3001 Docker\u5bb9\u5668\u65e5\u5fd7\u7ba1\u7406<\/h3>\n<p>Docker\u9ed8\u8ba4\u4f7f\u7528json-file\u65e5\u5fd7\u9a71\u52a8&#xff0c;\u5bb9\u5668\u6807\u51c6\u8f93\u51fa\u5c06\u5199\u5165\u5bbf\u4e3b\u673a\/var\/lib\/docker\/containers\u76ee\u5f55&#xff0c;\u4e14\u9ed8\u8ba4\u65e0\u5927\u5c0f\u9650\u5236\u3002\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u5bb9\u5668\u53ef\u80fd\u4ea7\u751f\u6570\u5341GB\u65e5\u5fd7\u3002<\/p>\n<p>5.1 \u8fd0\u884c\u65f6\u9650\u5236\u65e5\u5fd7\u5927\u5c0f<\/p>\n<p>bash<\/p>\n<p>docker run -d \\\\<br \/>\n  &#8211;log-opt max-size&#061;10m \\\\<br \/>\n  &#8211;log-opt max-file&#061;3 \\\\<br \/>\n  your-image<\/p>\n<p>5.2 docker-compose\u914d\u7f6e<\/p>\n<p>yaml<\/p>\n<p>services:<br \/>\n  app:<br \/>\n    image: your-image<br \/>\n    logging:<br \/>\n      driver: &#034;json-file&#034;<br \/>\n      options:<br \/>\n        max-size: &#034;10m&#034;<br \/>\n        max-file: &#034;3&#034;<\/p>\n<p>\u914d\u7f6e\u540e&#xff0c;\u5355\u4e2a\u5bb9\u5668\u65e5\u5fd7\u6587\u4ef6\u4e0a\u965010MB&#xff0c;\u4fdd\u75593\u4e2a\u8f6e\u8f6c\u6587\u4ef6&#xff0c;\u603b\u8ba1\u4e0d\u8d85\u8fc730MB\u3002<\/p>\n<h3>\u516d\u3001 \u65b9\u6848\u9009\u578b\u603b\u7ed3<\/h3>\n<table>\n<tr>\u573a\u666f\u63a8\u8350\u65b9\u6848\u5907\u6ce8<\/tr>\n<tbody>\n<tr>\n<td>\u670d\u52a1\u5668\u22643\u53f0&#xff0c;\u65e0\u96c6\u4e2d\u68c0\u7d22\u9700\u6c42<\/td>\n<td>logrotate<\/td>\n<td>\u96f6\u6210\u672c&#xff0c;\u7a33\u5b9a\u53ef\u9760<\/td>\n<\/tr>\n<tr>\n<td>\u670d\u52a1\u56683-10\u53f0&#xff0c;\u5e0c\u671b\u7edf\u4e00\u68c0\u7d22<\/td>\n<td>\u4e91\u65e5\u5fd7\u670d\u52a1&#xff08;SLS\/CLS&#xff09;<\/td>\n<td>\u4f4e\u8d39\u7528\u6362\u514d\u8fd0\u7ef4<\/td>\n<\/tr>\n<tr>\n<td>\u670d\u52a1\u5668&gt;10\u53f0<\/td>\n<td>ELK\u6216\u5546\u4e1a\u65e5\u5fd7\u5e73\u53f0<\/td>\n<td>\u9700\u6295\u5165\u4e13\u95e8\u8fd0\u7ef4\u4eba\u529b<\/td>\n<\/tr>\n<tr>\n<td>\u4f7f\u7528Docker<\/td>\n<td>\u914d\u7f6emax-size\u4e0emax-file<\/td>\n<td>\u907f\u514d\u5bbf\u4e3b\u673a\u78c1\u76d8\u5199\u6ee1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e03\u3001 \u5b89\u5168\u63d0\u793a<\/h3>\n<p>\u65e0\u8bba\u91c7\u7528\u4f55\u79cd\u65b9\u6848&#xff0c;\u4e25\u7981\u5728\u65e5\u5fd7\u4e2d\u8f93\u51fa\u4ee5\u4e0b\u4fe1\u606f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7528\u6237\u5bc6\u7801\u3001Token\u3001SessionID<\/p>\n<\/li>\n<li>\n<p>\u624b\u673a\u53f7\u3001\u8eab\u4efd\u8bc1\u53f7\u7b49\u4e2a\u4eba\u9690\u79c1\u4fe1\u606f<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u3001API\u5bc6\u94a5<\/p>\n<\/li>\n<\/ul>\n<p>\u65e5\u5fd7\u6587\u4ef6\u5728\u4f20\u8f93\u4e0e\u5b58\u50a8\u73af\u8282\u5747\u5b58\u5728\u6cc4\u9732\u98ce\u9669&#xff0c;\u5e94\u5728\u4ee3\u7801\u5c42\u9762\u8fdb\u884c\u8131\u654f\u5904\u7406\u3002<\/p>\n<p>\u5173\u4e8e\u4e91\u8d26\u53f7\u5f00\u901a&#xff1a;\u00a0\u82e5\u5728\u6ce8\u518c\u4e91\u5382\u5546\u65f6\u9047\u5230\u5b9e\u540d\u8ba4\u8bc1\u6216\u56fd\u9645\u4fe1\u7528\u5361\u969c\u788d&#xff0c;\u53ef\u901a\u8fc7Ztopcloud\u7b49\u4ee3\u7406\u6e20\u9053\u4f7f\u7528\u90ae\u7bb1\u6ce8\u518c\u5e76\u5145\u503c&#xff0c;\u5feb\u901f\u5f00\u901a\u65e5\u5fd7\u670d\u52a1\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u6458\u8981\u3011<br \/>\n\u670d\u52a1\u5668\u65e5\u5fd7\u6587\u4ef6\u65e0\u9650\u589e\u957f\u5bfc\u81f4\u78c1\u76d8\u5199\u6ee1&#xff0c;\u662f\u8fd0\u7ef4\u4e2d\u7684\u5e38\u89c1\u6545\u969c\u3002\u672c\u6587\u4ece\u5b9e\u6218\u89d2\u5ea6\u51fa\u53d1&#xff0c;\u4ecb\u7ecd\u4e09\u79cd\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848&#xff1a;\u57fa\u4e8eLinux logrotate\u7684\u672c\u5730\u65e5\u5fd7\u8f6e\u8f6c\u3001ELK\u6280\u672f\u6808\u7684\u9002\u7528\u6027\u8bc4\u4f30\u3001\u4ee5\u53ca\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1&#xff08;SLS\/CLS\/CloudWatch&#xff09;\u7684\u63a5\u5165\u4e0e\u6210\u672c\u5206\u6790\u3002\u540c\u65f6\u9488\u5bf9Docker\u5bb9\u5668\u7684\u65e5\u5fd7\u81a8\u80c0\u95ee\u9898\u63d0\u4f9b\u914d\u7f6e\u793a\u4f8b&#xff0c;\u5e76\u7ed9\u51fa\u65e5\u5fd7\u544a\u8b66\u89c4\u5219\u8bbe\u8ba1\u601d\u8def\u3002\u5173\u952e\u8bcd&#xff1a;\u00a0\u65e5\u5fd7\u7ba1\u7406, logrotate,<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27,43,44],"topic":[],"class_list":["post-82450","post","type-post","status-publish","format-standard","hentry","category-server","tag-docker","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/82450.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u6458\u8981\u3011 \u670d\u52a1\u5668\u65e5\u5fd7\u6587\u4ef6\u65e0\u9650\u589e\u957f\u5bfc\u81f4\u78c1\u76d8\u5199\u6ee1&#xff0c;\u662f\u8fd0\u7ef4\u4e2d\u7684\u5e38\u89c1\u6545\u969c\u3002\u672c\u6587\u4ece\u5b9e\u6218\u89d2\u5ea6\u51fa\u53d1&#xff0c;\u4ecb\u7ecd\u4e09\u79cd\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848&#xff1a;\u57fa\u4e8eLinux logrotate\u7684\u672c\u5730\u65e5\u5fd7\u8f6e\u8f6c\u3001ELK\u6280\u672f\u6808\u7684\u9002\u7528\u6027\u8bc4\u4f30\u3001\u4ee5\u53ca\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1&#xff08;SLS\/CLS\/CloudWatch&#xff09;\u7684\u63a5\u5165\u4e0e\u6210\u672c\u5206\u6790\u3002\u540c\u65f6\u9488\u5bf9Docker\u5bb9\u5668\u7684\u65e5\u5fd7\u81a8\u80c0\u95ee\u9898\u63d0\u4f9b\u914d\u7f6e\u793a\u4f8b&#xff0c;\u5e76\u7ed9\u51fa\u65e5\u5fd7\u544a\u8b66\u89c4\u5219\u8bbe\u8ba1\u601d\u8def\u3002\u5173\u952e\u8bcd&#xff1a;\u00a0\u65e5\u5fd7\u7ba1\u7406, logrotate,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/82450.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-25T01:11:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82450.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/82450.html\",\"name\":\"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-25T01:11:03+00:00\",\"dateModified\":\"2026-07-25T01:11:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/82450.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/82450.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82450.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/82450.html","og_locale":"zh_CN","og_type":"article","og_title":"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u6458\u8981\u3011 \u670d\u52a1\u5668\u65e5\u5fd7\u6587\u4ef6\u65e0\u9650\u589e\u957f\u5bfc\u81f4\u78c1\u76d8\u5199\u6ee1&#xff0c;\u662f\u8fd0\u7ef4\u4e2d\u7684\u5e38\u89c1\u6545\u969c\u3002\u672c\u6587\u4ece\u5b9e\u6218\u89d2\u5ea6\u51fa\u53d1&#xff0c;\u4ecb\u7ecd\u4e09\u79cd\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848&#xff1a;\u57fa\u4e8eLinux logrotate\u7684\u672c\u5730\u65e5\u5fd7\u8f6e\u8f6c\u3001ELK\u6280\u672f\u6808\u7684\u9002\u7528\u6027\u8bc4\u4f30\u3001\u4ee5\u53ca\u4e91\u5382\u5546\u65e5\u5fd7\u670d\u52a1&#xff08;SLS\/CLS\/CloudWatch&#xff09;\u7684\u63a5\u5165\u4e0e\u6210\u672c\u5206\u6790\u3002\u540c\u65f6\u9488\u5bf9Docker\u5bb9\u5668\u7684\u65e5\u5fd7\u81a8\u80c0\u95ee\u9898\u63d0\u4f9b\u914d\u7f6e\u793a\u4f8b&#xff0c;\u5e76\u7ed9\u51fa\u65e5\u5fd7\u544a\u8b66\u89c4\u5219\u8bbe\u8ba1\u601d\u8def\u3002\u5173\u952e\u8bcd&#xff1a;\u00a0\u65e5\u5fd7\u7ba1\u7406, logrotate,","og_url":"https:\/\/www.wsisp.com\/helps\/82450.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-25T01:11:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/82450.html","url":"https:\/\/www.wsisp.com\/helps\/82450.html","name":"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-25T01:11:03+00:00","dateModified":"2026-07-25T01:11:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/82450.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/82450.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/82450.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u670d\u52a1\u5668\u65e5\u5fd7\u7ba1\u7406\u6700\u4f73\u5b9e\u8df5\uff1alogrotate\u914d\u7f6e\u8be6\u89e3\u3001\u4e91\u65e5\u5fd7\u670d\u52a1\u5bf9\u6bd4\u4e0eDocker\u65e5\u5fd7\u9650\u5236\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=82450"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82450\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=82450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=82450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=82450"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=82450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}