{"id":1917,"date":"2022-08-19T09:51:46","date_gmt":"2022-08-19T09:51:46","guid":{"rendered":"https:\/\/www.ipcpu.com\/?p=1917"},"modified":"2022-08-19T09:59:13","modified_gmt":"2022-08-19T09:59:13","slug":"logs-aliyun-sls","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2022\/08\/logs-aliyun-sls\/","title":{"rendered":"\u5916\u90e8\u65e5\u5fd7(CDN\u65e5\u5fd7)\u5bfc\u5165\u5230\u963f\u91cc\u4e91\u65e5\u5fd7\u670d\u52a1SLS\u4e2d"},"content":{"rendered":"
<\/div>\n

\u4e00\u3001\u6982\u8ff0<\/h2>\n

\u6709\u65f6\u5019\u6211\u4eec\u7684\u65e5\u5fd7(\u4f8b\u5982CDN\u65e5\u5fd7)\u4e0d\u5728\u963f\u91cc\u4e91\uff0c\u4f46\u662f\u60f3\u8981\u5bfc\u5165\u5230\u963f\u91cc\u4e91\u7684\u65e5\u5fd7\u670d\u52a1SLS\u4e2d\u8fdb\u884c\u5206\u6790\u3002
\n\u8fd9\u65f6\u5019\u6211\u4eec\u4f18\u5148\u60f3\u5230\u7684\u662f\u628a\u65e5\u5fd7\u6587\u4ef6\u4f20\u5165\u963f\u91cc\u4e91\u7684ECS\u670d\u52a1\u5668\u4e0a(\u5165\u5e26\u5bbd\u662f\u514d\u8d39\u7684)\uff0c\u7136\u540e\u5728\u7528ilogtail\u5de5\u5177\u5bfc\u5165\uff0c\u4f46\u662f\u6211\u4eec\u53d1\u73b0\u8fd9\u4e2a\u8fc7\u7a0b\u8fd8\u6709\u5751\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u3002<\/p>\n

\u4e8c\u3001ilogtail\u4e0d\u80fd\u7528\u6765\u5bfc\u5165\u5386\u53f2\u6570\u636e<\/h2>\n

\u8fd9\u662f\u6211\u4eec\u9047\u5230\u7684\u7b2c\u4e00\u4e2a\u95ee\u9898\uff0c\u5c3d\u7ba1\u6211\u4eec\u914d\u7f6e\u597d\u4e86ilogtail\uff0c\u4f46\u662f\u53d1\u73b0\u6ca1\u6709\u6570\u636e\u6d88\u8d39\uff0c\u4e5f\u6ca1\u6709\u4efb\u4f55\u62a5\u9519\uff0c\u65e5\u5fd7\u670d\u52a1SLS\u4e2d\u5c31\u662f\u6ca1\u6709\u65e5\u5fd7\u3002
\n\u7ecf\u8fc7\u54a8\u8be2\u963f\u91cc\u7684\u5ba2\u670d\uff0c\u624d\u77e5\u9053\uff0cilogtail\u53ea\u4f1a\u5bf9\uff0c\u914d\u7f6e\u5b8c\u4ee5\u540e\uff0c\u65b0\u5199\u5165\u7684\u6570\u636e\u6709\u6548\uff0c\u4ee5\u524d\u5199\u5165\u7684\u65e5\u5fd7\u4e0d\u4f1a\u6536\u96c6\u3002
\n\u597d\u5427\uff0c\u90a3\u6211\u4f7f\u7528touch\u547d\u4ee4\u5bf9\u6587\u4ef6\u8fdb\u884c\u66f4\u65b0\u4e0b\uff1f<\/p>\n

\u7ed3\u679c\uff0c\u786e\u5b9e\u6709\u6570\u636e\u8fdb\u6765\u4e86\uff0c\u4f46\u662f\uff0c\u8fd9\u6570\u91cf\u7ea7\u660e\u663e\u5bf9\u4e0d\u4e0a\uff0c\u53ea\u80fd\u518d\u6b21\u54a8\u8be2\u5ba2\u670d\u3002
\n<\/p>\n

\u4e09\u3001\u5386\u53f2\u65e5\u5fd7\u6587\u4ef6\u7684\u5bfc\u5165\u65b9\u5f0f<\/h2>\n

\u963f\u91cc\u5ba2\u670d\u4e00\u542c\u5c31\u660e\u767d\u4e86\uff0c\u7529\u8fc7\u6765\u4e00\u4e2a\u94fe\u63a5\u3002
\nhttps:\/\/help.aliyun.com\/document_detail\/71414.html<\/a>
\n\u597d\u5427\uff0c\u539f\u6765\u65e9\u5c31\u8003\u8651\u5230\u8fd9\u4e2a\u95ee\u9898\u4e86\u3002<\/p>\n

\u9700\u8981\u5728ilogtail\u76ee\u5f55\u4e0b\u653e\u7f6e\u4e00\u4e2a\u6587\u4ef6local_event.json\uff0c\u5185\u5bb9\u5982\u4e0b<\/p>\n

\n
[ \n  {\n    \"config\" : \"##1.0##ipcpuslblog$volc\",\n    \"dir\" : \"\/data\/logs\/cdn\",\n    \"name\" : \"myaccess.log\"\n   }\n]<\/code><\/pre>\n<\/div>\n

\u8fd9\u91cc\u9762\u7684config\u5b57\u6bb5\uff0c\u9700\u8981\u586b\u5199Logtail\u914d\u7f6e\u7684\u552f\u4e00\u6807\u8bc6\uff0c\u53ef\u4ee5\u4e0b\u9762\u547d\u4ee4\u83b7\u53d6<\/p>\n

\n
grep \"##\" \/usr\/local\/ilogtail\/user_log_config.json | awk '{print $1}'<\/code><\/pre>\n<\/div>\n

\u597d\u4e86\uff0c\u5bfc\u5165\u901f\u5ea6\u8fd8\u633a\u5feb\uff0c\u8fd9\u4e0b\u6709\u6570\u636e\u4e86\u3002
\n<\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u5916\u90e8\u65e5\u5fd7(CDN\u65e5\u5fd7)\u5bfc\u5165\u5230\u963f\u91cc\u4e91\u65e5\u5fd7\u670d\u52a1SLS\u4e2d<\/a><\/p>","protected":false},"excerpt":{"rendered":"

\u4e00\u3001\u6982\u8ff0 \u6709\u65f6\u5019\u6211\u4eec\u7684\u65e5\u5fd7(\u4f8b\u5982CDN\u65e5\u5fd7)\u4e0d\u5728\u963f\u91cc\u4e91\uff0c\u4f46\u662f\u60f3\u8981\u5bfc\u5165\u5230\u963f\u91cc\u4e91\u7684\u65e5\u5fd7\u670d\u52a1SLS\u4e2d\u8fdb\u884c\u5206\u6790\u3002 \u8fd9\u65f6\u5019\u6211\u4eec\u4f18\u5148\u60f3\u5230\u7684\u662f\u628a\u65e5\u5fd7\u6587\u4ef6\u4f20\u5165\u963f\u91cc\u4e91\u7684ECS\u670d\u52a1\u5668\u4e0a(\u5165\u5e26\u5bbd\u662f\u514d\u8d39\u7684)\uff0c\u7136\u540e\u5728\u7528ilogtail\u5de5\u5177\u5bfc\u5165\uff0c\u4f46\u662f\u6211\u4eec\u53d1\u73b0\u8fd9\u4e2a\u8fc7\u7a0b\u8fd8\u6709\u5751\uff0c\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u3002 \u4e8c\u3001ilogtail\u4e0d\u80fd\u7528\u6765\u5bfc\u5165\u5386\u53f2\u6570\u636e \u8fd9\u662f\u6211\u4eec\u9047\u5230\u7684\u7b2c\u4e00\u4e2a\u95ee\u9898\uff0c\u5c3d\u7ba1\u6211\u4eec\u914d\u7f6e\u597d\u4e86ilogtail\uff0c\u4f46\u662f\u53d1\u73b0\u6ca1\u6709\u6570\u636e\u6d88\u8d39\uff0c\u4e5f\u6ca1\u6709\u4efb\u4f55\u62a5\u9519\uff0c\u65e5\u5fd7\u670d\u52a1SLS\u4e2d\u5c31\u662f\u6ca1\u6709\u65e5\u5fd7\u3002 \u7ecf\u8fc7\u54a8\u8be2\u963f\u91cc\u7684\u5ba2\u670d\uff0c\u624d\u77e5\u9053\uff0cilogtail\u53ea\u4f1a\u5bf9\uff0c\u914d\u7f6e\u5b8c\u4ee5\u540e\uff0c\u65b0\u5199\u5165\u7684\u6570\u636e\u6709\u6548\uff0c\u4ee5\u524d\u5199\u5165\u7684\u65e5\u5fd7\u4e0d\u4f1a\u6536\u96c6\u3002 \u597d\u5427\uff0c\u90a3\u6211\u4f7f\u7528touch\u547d\u4ee4\u5bf9\u6587\u4ef6\u8fdb\u884c\u66f4\u65b0\u4e0b\uff1f \u7ed3\u679c\uff0c\u786e\u5b9e\u6709\u6570\u636e\u8fdb\u6765\u4e86\uff0c\u4f46\u662f\uff0c\u8fd9\u6570\u91cf\u7ea7\u660e\u663e\u5bf9\u4e0d\u4e0a\uff0c\u53ea\u80fd\u518d\u6b21\u54a8\u8be2\u5ba2\u670d\u3002 \u4e09\u3001\u5386\u53f2\u65e5\u5fd7\u6587\u4ef6\u7684\u5bfc\u5165\u65b9\u5f0f \u963f\u91cc\u5ba2\u670d\u4e00\u542c\u5c31\u660e\u767d\u4e86\uff0c\u7529\u8fc7\u6765\u4e00\u4e2a\u94fe\u63a5\u3002 https:\/\/help.aliyun.com\/document_detail\/71414.html \u597d\u5427\uff0c\u539f\u6765\u65e9\u5c31\u8003\u8651\u5230\u8fd9\u4e2a\u95ee\u9898\u4e86\u3002 \u9700\u8981\u5728ilogtail\u76ee\u5f55\u4e0b\u653e\u7f6e\u4e00\u4e2a\u6587\u4ef6local_event.json\uff0c\u5185\u5bb9\u5982\u4e0b [ { “config” : “##1.0##ipcpuslblog$volc”, “dir” : “\/data\/logs\/cdn”, “name” : “myaccess.log” } ] \u8fd9\u91cc\u9762\u7684config\u5b57\u6bb5\uff0c\u9700\u8981\u586b\u5199Logtail\u914d\u7f6e\u7684\u552f\u4e00\u6807\u8bc6\uff0c\u53ef\u4ee5\u4e0b\u9762\u547d\u4ee4\u83b7\u53d6 grep “##” \/usr\/local\/ilogtail\/user_log_config.json | awk ‘{print $1}’ \u597d\u4e86\uff0c\u5bfc\u5165\u901f\u5ea6\u8fd8\u633a\u5feb\uff0c\u8fd9\u4e0b\u6709\u6570\u636e\u4e86\u3002 \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def » \u5916\u90e8\u65e5\u5fd7(CDN\u65e5\u5fd7)\u5bfc\u5165\u5230\u963f\u91cc\u4e91\u65e5\u5fd7\u670d\u52a1SLS\u4e2d<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[123,242],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1917"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=1917"}],"version-history":[{"count":1,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1917\/revisions"}],"predecessor-version":[{"id":1918,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1917\/revisions\/1918"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=1917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=1917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=1917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}