{"id":11725,"date":"2023-08-09T21:42:00","date_gmt":"2023-08-09T13:42:00","guid":{"rendered":"http:\/\/92it.top\/?p=11725"},"modified":"2023-08-18T09:31:43","modified_gmt":"2023-08-18T01:31:43","slug":"%e4%bd%a0%e5%bf%85%e9%a1%bb%e7%9f%a5%e9%81%93%e7%9a%84%e5%ae%b9%e5%99%a8%e6%97%a5%e5%bf%97-%e5%bc%80%e6%ba%90%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86%e6%96%b9%e6%a1%88-elk-efk","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=11725","title":{"rendered":"\u4f60\u5fc5\u987b\u77e5\u9053\u7684\u5bb9\u5668\u65e5\u5fd7 \u5f00\u6e90\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848 ELK\/EFK"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_logs_study_summary_part2.html\">https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_logs_study_summary_part2.html<\/a><\/p>\n\n\n\n<p>\u672c\u7bc7\u5df2\u52a0\u5165\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/aspnet_core_k8s_artcles_index.html\" target=\"_blank\">.NET Core on K8S\u5b66\u4e60\u5b9e\u8df5\u7cfb\u5217\u6587\u7ae0\u7d22\u5f15<\/a>\u300b\uff0c\u53ef\u4ee5\u70b9\u51fb\u67e5\u770b\u66f4\u591a\u5bb9\u5668\u5316\u6280\u672f\u76f8\u5173\u7cfb\u5217\u6587\u7ae0\u3002\u4e0a\u4e00\u7bc7\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_logs_study_summary_part1.html\" target=\"_blank\">\u4f60\u5fc5\u987b\u77e5\u9053\u7684\u5bb9\u5668\u65e5\u5fd7\uff081\uff09<\/a>\u300b\u4e2d\u4ecb\u7ecd\u4e86Docker\u81ea\u5e26\u7684logs\u5b50\u547d\u4ee4\u4ee5\u53ca\u5176Logging driver\uff0c\u672c\u7bc7\u5c06\u4f1a\u4ecb\u7ecd\u4e00\u4e2a\u6d41\u884c\u7684\u5f00\u6e90\u65e5\u5fd7\u7ba1\u7406\u65b9\u6848ELK\u3002<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u5173\u4e8eELK<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>1.1 ELK\u7b80\u4ecb<\/strong><\/p>\n\n\n\n<p>ELK \u662fElastic\u516c\u53f8\u63d0\u4f9b\u7684\u4e00\u5957<strong>\u5b8c\u6574\u7684\u65e5\u5fd7\u6536\u96c6\u4ee5\u53ca\u5c55\u793a\u7684\u89e3\u51b3\u65b9\u6848<\/strong>\uff0c\u662f\u4e09\u4e2a\u4ea7\u54c1\u7684\u9996\u5b57\u6bcd\u7f29\u5199\uff0c\u5206\u522b\u662f<strong>ElasticSearch<\/strong>\u3001<strong>Logstash<\/strong> \u548c <strong>Kibana<\/strong>\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-1024x378.png\" alt=\"\" class=\"wp-image-11726\" width=\"529\" height=\"195\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-1024x378.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-300x111.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-768x283.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-830x306.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-230x85.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-350x129.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50-480x177.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-50.png 1268w\" sizes=\"(max-width: 529px) 100vw, 529px\" \/><\/figure><\/div>\n\n\n\n<ul><li>Elasticsearch\u662f\u5b9e\u65f6\u5168\u6587\u641c\u7d22\u548c\u5206\u6790\u5f15\u64ce\uff0c\u63d0\u4f9b\u641c\u96c6\u3001\u5206\u6790\u3001\u5b58\u50a8\u6570\u636e\u4e09\u5927\u529f\u80fd<\/li><li>Logstash\u662f\u4e00\u4e2a\u7528\u6765\u641c\u96c6\u3001\u5206\u6790\u3001\u8fc7\u6ee4\u65e5\u5fd7\u7684\u5de5\u5177<\/li><li>Kibana\u662f\u4e00\u4e2a\u57fa\u4e8eWeb\u7684\u56fe\u5f62\u754c\u9762\uff0c\u7528\u4e8e\u641c\u7d22\u3001\u5206\u6790\u548c\u53ef\u89c6\u5316\u5b58\u50a8\u5728 Elasticsearch\u6307\u6807\u4e2d\u7684\u65e5\u5fd7\u6570\u636e&nbsp;<\/li><\/ul>\n\n\n\n<p><strong>1.2 ELK\u65e5\u5fd7\u5904\u7406\u6d41\u7a0b<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-1024x440.png\" alt=\"\" class=\"wp-image-11727\" width=\"508\" height=\"217\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-1024x440.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-300x129.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-768x330.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-230x99.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-350x150.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51-480x206.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-51.png 1326w\" sizes=\"(max-width: 508px) 100vw, 508px\" \/><\/figure><\/div>\n\n\n\n<p>\u4e0a\u56fe\u5c55\u793a\u4e86\u5728Docker\u73af\u5883\u4e0b\uff0c\u4e00\u4e2a\u5178\u578b\u7684ELK\u65b9\u6848\u4e0b\u7684\u65e5\u5fd7\u6536\u96c6\u5904\u7406\u6d41\u7a0b\uff1a<\/p>\n\n\n\n<ul><li>Logstash\u4ece\u5404\u4e2aDocker\u5bb9\u5668\u4e2d\u63d0\u53d6\u65e5\u5fd7\u4fe1\u606f<\/li><li>Logstash\u5c06\u65e5\u5fd7\u8f6c\u53d1\u5230ElasticSearch\u8fdb\u884c\u7d22\u5f15\u548c\u4fdd\u5b58<\/li><li>Kibana\u8d1f\u8d23\u5206\u6790\u548c\u53ef\u89c6\u5316\u65e5\u5fd7\u4fe1\u606f<\/li><\/ul>\n\n\n\n<p>\u7531\u4e8eLogstash\u5728\u6570\u636e\u6536\u96c6\u4e0a\u5e76\u4e0d\u51fa\u8272\uff0c\u800c\u4e14\u4f5c\u4e3aAgent\uff0c\u5176\u6027\u80fd\u5e76\u4e0d\u8fbe\u6807\u3002\u57fa\u4e8e\u6b64\uff0cElastic\u53d1\u5e03\u4e86beats\u7cfb\u5217\u8f7b\u91cf\u7ea7\u91c7\u96c6\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-1024x719.png\" alt=\"\" class=\"wp-image-11728\" width=\"443\" height=\"310\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-1024x719.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-300x211.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-768x540.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-830x583.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-230x162.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-350x246.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52-480x337.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-52.png 1392w\" sizes=\"(max-width: 443px) 100vw, 443px\" \/><\/figure><\/div>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u8981\u5b9e\u8df5\u7684Beat\u7ec4\u4ef6\u662fFilebeat\uff0cFilebeat\u662f\u6784\u5efa\u4e8ebeats\u4e4b\u4e0a\u7684\uff0c\u5e94\u7528\u4e8e<strong>\u65e5\u5fd7\u6536\u96c6<\/strong>\u573a\u666f\u7684\u5b9e\u73b0\uff0c\u7528\u6765\u66ff\u4ee3&nbsp;<strong>Logstash Forwarder<\/strong>&nbsp;\u7684\u4e0b\u4e00\u4ee3&nbsp;<strong>Logstash<\/strong>&nbsp;\u6536\u96c6\u5668\uff0c\u662f\u4e3a\u4e86\u66f4\u5feb\u901f\u7a33\u5b9a\u8f7b\u91cf\u4f4e\u8017\u5730\u8fdb\u884c\u6536\u96c6\u5de5\u4f5c\uff0c\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4e0e&nbsp;<strong>Logstash<\/strong>&nbsp;\u8fd8\u6709\u76f4\u63a5\u4e0e&nbsp;<strong>Elasticsearch<\/strong>&nbsp;\u8fdb\u884c\u5bf9\u63a5\u3002<\/p>\n\n\n\n<p>\u672c\u6b21\u5b9e\u9a8c\u76f4\u63a5\u4f7f\u7528Filebeat\u4f5c\u4e3aAgent\uff0c\u5b83\u4f1a\u6536\u96c6\u6211\u4eec\u5728\u7b2c\u4e00\u7bc7\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_logs_study_summary_part1.html\" target=\"_blank\">Docker logs &amp; logging driver<\/a>\u300b\u4e2d\u4ecb\u7ecd\u7684json-file\u7684log\u6587\u4ef6\u4e2d\u7684\u8bb0\u5f55\u53d8\u52a8\uff0c\u5e76\u76f4\u63a5\u5c06\u65e5\u5fd7\u53d1\u7ed9ElasticSearch\u8fdb\u884c\u7d22\u5f15\u548c\u4fdd\u5b58\uff0c\u5176\u5904\u7406\u6d41\u7a0b\u53d8\u4e3a\u4e0b\u56fe\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8ba4\u4e3a\u5b83\u53ef\u4ee5\u79f0\u4f5c EFK\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-1024x432.png\" alt=\"\" class=\"wp-image-11731\" width=\"507\" height=\"214\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-1024x432.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-300x127.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-768x324.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-830x350.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-230x97.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-350x148.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54-480x202.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-54.png 1318w\" sizes=\"(max-width: 507px) 100vw, 507px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u4e8c\u3001ELK\u5957\u4ef6\u7684\u5b89\u88c5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u672c\u6b21\u5b9e\u9a8c\u6211\u4eec\u91c7\u7528Docker\u65b9\u5f0f\u90e8\u7f72\u4e00\u4e2a\u6700\u5c0f\u89c4\u6a21\u7684ELK\u8fd0\u884c\u73af\u5883\uff0c\u5f53\u7136\uff0c\u5b9e\u9645\u73af\u5883\u4e2d\u6211\u4eec\u6216\u8bb8\u9700\u8981\u8003\u8651\u9ad8\u53ef\u7528\u548c\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u62c9\u53d6\u4e00\u4e0bsebp\/elk\u8fd9\u4e2a\u96c6\u6210\u955c\u50cf\uff0c\u8fd9\u91cc\u9009\u62e9\u7684tag\u7248\u672c\u662f640\uff08\u6700\u65b0\u7248\u672c\u5df2\u7ecf\u662f7XX\u4e86\uff09\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker pull sebp\/elk:640<\/pre>\n\n\n\n<p><strong>\u6ce8\uff1a<\/strong>\u7531\u4e8e\u5176\u5305\u542b\u4e86\u6574\u4e2aELK\u65b9\u6848\uff0c\u6240\u4ee5\u9700\u8981\u8010\u5fc3\u7b49\u5f85\u4e00\u4f1a\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u7528sebp\/elk\u8fd9\u4e2a\u96c6\u6210\u955c\u50cf\u542f\u52a8\u8fd0\u884cELK\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -it -d --name elk \\\n    -p 5601:5601 \\\n    -p 9200:9200 \\\n    -p 5044:5044 \\\n    sebp\/elk:640<\/pre>\n\n\n\n<p>\u8fd0\u884c\u5b8c\u6210\u4e4b\u540e\u5c31\u53ef\u4ee5\u5148\u8bbf\u95ee\u4e00\u4e0b http:\/\/[Your-HostIP]:5601 \u770b\u770bKibana\u7684\u6548\u679c\uff1a\u3000\u3000<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-1024x476.png\" alt=\"\" class=\"wp-image-11732\" width=\"473\" height=\"220\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-1024x476.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-300x139.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-768x357.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-830x386.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-230x107.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-350x163.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55-480x223.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-55.png 1386w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><figcaption>Kibana\u7ba1\u7406\u754c\u9762<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-1024x390.png\" alt=\"\" class=\"wp-image-11733\" width=\"511\" height=\"194\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-1024x390.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-300x114.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-768x293.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-830x316.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-230x88.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-350x133.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56-480x183.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-56.png 1402w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><figcaption>Kibana Index Patterns\u754c\u9762<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u5f53\u7136\uff0c\u76ee\u524d\u6ca1\u6709\u4efb\u4f55\u53ef\u4ee5\u663e\u793a\u7684ES\u7684\u7d22\u5f15\u548c\u6570\u636e\uff0c\u518d\u8bbf\u95ee\u4e00\u4e0bhttp:\/\/[Your-HostIP]:9200 \u770b\u770bElasticSearch\u7684API\u63a5\u53e3\u662f\u5426\u53ef\u7528\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-1009x1024.png\" alt=\"\" class=\"wp-image-11734\" width=\"474\" height=\"481\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-1009x1024.png 1009w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-295x300.png 295w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-768x780.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-830x843.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-230x234.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-350x355.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57-480x487.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-57.png 1050w\" sizes=\"(max-width: 474px) 100vw, 474px\" \/><figcaption>ElasticSearch API<\/figcaption><\/figure><\/div>\n\n\n\n<p><em><strong>Note\uff1a<\/strong><\/em>\u5982\u679c\u542f\u52a8\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u4e00\u4e9b\u9519\u8bef\uff0c\u5bfc\u81f4ELK\u5bb9\u5668\u65e0\u6cd5\u542f\u52a8\uff0c\u53ef\u4ee5\u53c2\u8003\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jianshu.com\/p\/1e6763f0b817\" target=\"_blank\">Docker\u542f\u52a8ElasticSearch\u62a5\u9519<\/a>\u300b\u53ca\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/www.cnblogs.com\/zhi-leaf\/p\/8484337.html\" target=\"_blank\">ElasticSearch\u542f\u52a8\u5e38\u89c1\u9519\u8bef<\/a>\u300b\u4e00\u6587\u3002\u5982\u679c\u4f60\u7684\u4e3b\u673a\u5185\u5b58\u4f4e\u4e8e4G\uff0c\u5efa\u8bae\u589e\u52a0\u914d\u7f6e\u8bbe\u7f6eES\u5185\u5b58\u4f7f\u7528\u5927\u5c0f\uff0c\u4ee5\u514d\u542f\u52a8\u4e0d\u4e86\u3002\u4f8b\u5982\u4e0b\u9762\u589e\u52a0\u7684\u914d\u7f6e\uff0c\u9650\u5236ES\u5185\u5b58\u4f7f\u7528\u6700\u5927\u4e3a1G\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -it -d --name elk \\\n    -p 5601:5601 \\\n    -p 9200:9200 \\\n    -p 5044:5044 \\ \u3000\u3000-e ES_MIN_MEM=512m \\\n    -e ES_MAX_MEM=1024m \\\n    sebp\/elk:640<\/pre>\n\n\n\n<p><strong>\u4e09\u3001Filebeat\u914d\u7f6e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>3.1 \u5b89\u88c5Filebeat<\/strong><\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u901a\u8fc7rpm\u7684\u65b9\u5f0f\u4e0b\u8f7dFilebeat\uff0c\u6ce8\u610f\u8fd9\u91cc\u4e0b\u8f7d\u548c\u6211\u4eecELK\u5bf9\u5e94\u7684\u7248\u672c\uff08ELK\u662f6.4.0\uff0c\u8fd9\u91cc\u4e5f\u662f\u4e0b\u8f7d6.4.0\uff0c\u907f\u514d\u51fa\u73b0\u9519\u8bef\uff09\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/artifacts.elastic.co\/downloads\/beats\/filebeat\/filebeat-6.4.0-x86_64.rpm\nrpm -ivh filebeat-6.4.0-x86_64.rpm<\/pre>\n\n\n\n<p><strong>3.2 \u914d\u7f6eFilebeat<\/strong><\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u544a\u8bc9Filebeat\u8981\u76d1\u63a7\u54ea\u4e9b\u65e5\u5fd7\u6587\u4ef6 \u53ca \u5c06\u65e5\u5fd7\u53d1\u9001\u5230\u54ea\u91cc\u53bb\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u4fee\u6539\u4e00\u4e0bFilebeat\u7684\u914d\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/etc\/filebeat\nvim filebeat.yml<\/pre>\n\n\n\n<p>\u8981\u4fee\u6539\u7684\u5185\u5bb9\u4e3a\uff1a<\/p>\n\n\n\n<p>\uff081\uff09\u76d1\u63a7\u54ea\u4e9b\u65e5\u5fd7\uff1f<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">filebeat.inputs:\n\n# Each - is an input. Most options can be set at the input level, so\n# you can use different inputs for various configurations.\n# Below are the input specific configurations.\n\n- type: log\n\n  # Change to true to enable this input configuration.\n  enabled: true\n\n  # Paths that should be crawled and fetched. Glob based paths.\n  paths:\n    - \/var\/lib\/docker\/containers\/*\/*.log\n    - \/var\/log\/syslog<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u6307\u5b9apaths\uff1a\/var\/lib\/docker\/containers\/<em>\/<\/em>.log\uff0c\u53e6\u5916\u9700\u8981\u6ce8\u610f\u7684\u662f\u5c06 enabled \u8bbe\u4e3a true\u3002<\/p>\n\n\n\n<p>\uff082\uff09\u5c06\u65e5\u5fd7\u53d1\u5230\u54ea\u91cc\uff1f<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#-------------------------- Elasticsearch output ------------------------------\noutput.elasticsearch:\n  # Array of hosts to connect to.\n  hosts: [\"192.168.16.190:9200\"]\n\n  # Optional protocol and basic auth credentials.\n  #protocol: \"https\"\n  #username: \"elastic\"\n  #password: \"changeme\"<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u6307\u5b9a\u76f4\u63a5\u53d1\u9001\u5230ElasticSearch\uff0c\u914d\u7f6e\u4e00\u4e0bES\u7684\u63a5\u53e3\u5730\u5740\u5373\u53ef\u3002<\/p>\n\n\n\n<p><em><strong>Note\uff1a<\/strong><\/em>\u5982\u679c\u8981\u53d1\u5230Logstash\uff0c\u8bf7\u4f7f\u7528\u540e\u9762\u8fd9\u6bb5\u914d\u7f6e\uff0c\u5c06\u5176\u53d6\u6d88\u6ce8\u91ca\u8fdb\u884c\u76f8\u5173\u914d\u7f6e\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#----------------------------- Logstash output --------------------------------\n#output.logstash:\n  # The Logstash hosts\n  #hosts: [\"localhost:5044\"]\n\n  # Optional SSL. By default is off.\n  # List of root certificates for HTTPS server verifications\n  #ssl.certificate_authorities: [\"\/etc\/pki\/root\/ca.pem\"]\n\n  # Certificate for SSL client authentication\n  #ssl.certificate: \"\/etc\/pki\/client\/cert.pem\"\n\n  # Client Certificate Key\n  #ssl.key: \"\/etc\/pki\/client\/cert.key\"<\/pre>\n\n\n\n<p><strong>3.3 \u542f\u52a8Filebeat<\/strong><\/p>\n\n\n\n<p>\u7531\u4e8eFilebeat\u5728\u5b89\u88c5\u65f6\u5df2\u7ecf\u6ce8\u518c\u4e3asystemd\u7684\u670d\u52a1\uff0c\u6240\u4ee5\u53ea\u9700\u8981\u76f4\u63a5\u542f\u52a8\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl start filebeat.service<\/pre>\n\n\n\n<p>\u68c0\u67e5Filebeat\u542f\u52a8\u72b6\u6001\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status filebeat.service<\/pre>\n\n\n\n<p><strong>3.4 \u9a8c\u8bc1Filebeat<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7\u8bbf\u95eeElasticSearch API\u53ef\u4ee5\u53d1\u73b0\u4ee5\u4e0b\u53d8\u5316\uff1aES\u5efa\u7acb\u4e86\u4ee5filebeat-\u5f00\u5934\u7684\u7d22\u5f15\uff0c\u6211\u4eec\u8fd8\u80fd\u591f\u770b\u5230\u5176\u6765\u6e90\u53ca\u5177\u4f53\u7684message\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-1024x465.png\" alt=\"\" class=\"wp-image-11735\" width=\"528\" height=\"239\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-1024x465.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-300x136.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-768x349.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-830x377.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-230x104.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-350x159.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58-480x218.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-58.png 1392w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u56db\u3001Kibana\u914d\u7f6e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u8981\u544a\u8bc9Kibana\uff0c\u8981\u67e5\u8be2\u548c\u5206\u6790ElasticSearch\u4e2d\u7684\u54ea\u4e9b\u65e5\u5fd7\uff0c\u56e0\u6b64\u9700\u8981\u914d\u7f6e\u4e00\u4e2aIndex Pattern\u3002\u4eceFilebeat\u4e2d\u6211\u4eec\u77e5\u9053Index\u662ffilebeat-timestamp\u8fd9\u79cd\u683c\u5f0f\uff0c\u56e0\u6b64\u8fd9\u91cc\u6211\u4eec\u5b9a\u4e49Index Pattern\u4e3a filebeat-*<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-1024x468.png\" alt=\"\" class=\"wp-image-11736\" width=\"500\" height=\"228\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-1024x468.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-300x137.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-768x351.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-830x379.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-230x105.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-350x160.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59-480x219.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-59.png 1410w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure><\/div>\n\n\n\n<p>\u70b9\u51fbNext Step\uff0c\u8fd9\u91cc\u6211\u4eec\u9009\u62e9Time Filter field name\u4e3a@timestamp\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-1024x517.png\" alt=\"\" class=\"wp-image-11737\" width=\"486\" height=\"245\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-1024x517.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-300x152.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-768x388.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-830x419.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-230x116.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-350x177.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60-480x242.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-60.png 1394w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/figure><\/div>\n\n\n\n<p>\u5355\u51fbCreate index pattern\u6309\u94ae\uff0c\u5373\u53ef\u5b8c\u6210\u914d\u7f6e\u3002<\/p>\n\n\n\n<p>\u8fd9\u65f6\u6211\u4eec\u5355\u51fbKibana\u5de6\u4fa7\u7684Discover\u83dc\u5355\uff0c\u5373\u53ef\u770b\u5230\u5bb9\u5668\u7684\u65e5\u5fd7\u4fe1\u606f\u5566\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-1024x471.png\" alt=\"\" class=\"wp-image-11738\" width=\"562\" height=\"258\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-1024x471.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-300x138.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-768x353.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-830x382.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-230x106.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-350x161.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61-480x221.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-61.png 1400w\" sizes=\"(max-width: 562px) 100vw, 562px\" \/><\/figure><\/div>\n\n\n\n<p>\u4ed4\u7ec6\u770b\u770b\u7ec6\u8282\uff0c\u6211\u4eec\u5173\u6ce8\u4e00\u4e0bmessage\u5b57\u6bb5\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-1024x212.png\" alt=\"\" class=\"wp-image-11739\" width=\"588\" height=\"121\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-1024x212.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-300x62.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-768x159.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-830x171.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-230x48.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-350x72.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62-480x99.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-62.png 1394w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><\/figure><\/div>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u6211\u4eec\u91cd\u70b9\u8981\u5173\u6ce8\u7684\u662fmessage\uff0c\u56e0\u6b64\u6211\u4eec\u4e5f\u53ef\u4ee5\u7b5b\u9009\u4e00\u4e0b\u53ea\u770b\u8fd9\u4e2a\u5b57\u6bb5\u7684\u4fe1\u606f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-1024x530.png\" alt=\"\" class=\"wp-image-11740\" width=\"536\" height=\"276\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-1024x530.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-300x155.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-768x397.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-830x429.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-230x119.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-350x181.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63-480x248.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-63.png 1392w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/figure><\/div>\n\n\n\n<p>\u6b64\u5916\uff0cKibana\u8fd8\u63d0\u4f9b\u4e86\u641c\u7d22\u5173\u952e\u8bcd\u7684\u65e5\u5fd7\u529f\u80fd\uff0c\u4f8b\u5982\u8fd9\u91cc\u6211\u5173\u6ce8\u4e00\u4e0b\u65e5\u5fd7\u4e2d\u5305\u542bunhandled exception\uff08\u672a\u5904\u7406\u5f02\u5e38\uff09\u7684\u65e5\u5fd7\u4fe1\u606f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-1024x539.png\" alt=\"\" class=\"wp-image-11741\" width=\"578\" height=\"304\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-1024x539.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-300x158.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-768x404.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-830x437.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-230x121.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-350x184.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64-480x253.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-64.png 1402w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/figure><\/div>\n\n\n\n<p>\u8fd9\u91cc\u53ea\u662f\u6734\u7d20\u7684\u5c55\u793a\u4e86\u5bfc\u5165ELK\u7684\u65e5\u5fd7\u4fe1\u606f\uff0c\u5b9e\u9645\u4e0aELK\u8fd8\u6709\u5f88\u591a\u5f88\u4e30\u5bcc\u7684\u73a9\u6cd5\uff0c\u4f8b\u5982\u5206\u6790\u805a\u5408\u3001\u70ab\u9177Dashboard\u7b49\u7b49\u3002\u7b14\u8005\u5728\u8fd9\u91cc\u4e5f\u662f\u521d\u6b65\u4f7f\u7528\uff0c\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u5566\u3002<\/p>\n\n\n\n<p><strong>\u4e94\u3001Fluentd\u5f15\u5165<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>5.1 \u5173\u4e8eFluentd<\/strong><\/p>\n\n\n\n<p>\u524d\u9762\u6211\u4eec\u91c7\u7528\u7684\u662fFilebeat\u6536\u96c6Docker\u7684\u65e5\u5fd7\u4fe1\u606f\uff0c\u57fa\u4e8eDocker\u9ed8\u8ba4\u7684json-file\u8fd9\u4e2alogging driver\uff0c\u8fd9\u91cc\u6211\u4eec\u6539\u7528Fluentd\u8fd9\u4e2a\u5f00\u6e90\u9879\u76ee\u6765\u66ff\u6362json-file\u6536\u96c6\u5bb9\u5668\u7684\u65e5\u5fd7\u3002<\/p>\n\n\n\n<p>Fluentd\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u6570\u636e\u6536\u96c6\u5668\uff0c\u4e13\u4e3a\u5904\u7406\u6570\u636e\u6d41\u8bbe\u8ba1\uff0c\u4f7f\u7528JSON\u4f5c\u4e3a\u6570\u636e\u683c\u5f0f\u3002\u5b83\u91c7\u7528\u4e86\u63d2\u4ef6\u5f0f\u7684\u67b6\u6784\uff0c\u5177\u6709\u9ad8\u53ef\u6269\u5c55\u6027\u9ad8\u53ef\u7528\u6027\uff0c\u540c\u65f6\u8fd8\u5b9e\u73b0\u4e86\u9ad8\u53ef\u9760\u7684\u4fe1\u606f\u8f6c\u53d1\u3002Fluentd\u4e5f\u662f\u4e91\u539f\u751f\u57fa\u91d1\u4f1a (CNCF) \u7684\u6210\u5458\u9879\u76ee\u4e4b\u4e00\uff0c\u9075\u5faaApache 2 License\u534f\u8bae\uff0c\u5176github\u5730\u5740\u4e3a\uff1a<a href=\"https:\/\/github.com\/fluent\/fluentd\/\">https:\/\/github.com\/fluent\/fluentd\/<\/a>\u3002Fluentd\u4e0eLogstash\u76f8\u6bd4\uff0c\u6bd4\u5360\u7528\u5185\u5b58\u66f4\u5c11\u3001\u793e\u533a\u66f4\u6d3b\u8dc3\uff0c\u4e24\u8005\u7684\u5bf9\u6bd4\u53ef\u4ee5\u53c2\u8003\u8fd9\u7bc7\u6587\u7ae0\u300a<a rel=\"noreferrer noopener\" href=\"https:\/\/logz.io\/blog\/fluentd-logstash\/\" target=\"_blank\">Fluentd vs Logstash<\/a>\u300b\u3002<\/p>\n\n\n\n<p>\u56e0\u6b64\uff0c\u6574\u4e2a\u65e5\u5fd7\u6536\u96c6\u4e0e\u5904\u7406\u6d41\u7a0b\u53d8\u4e3a\u4e0b\u56fe\uff0c\u6211\u4eec\u7528 Filebeat \u5c06 Fluentd \u6536\u96c6\u5230\u7684\u65e5\u5fd7\u8f6c\u53d1\u7ed9 Elasticsearch\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-1024x386.png\" alt=\"\" class=\"wp-image-11742\" width=\"523\" height=\"196\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-1024x386.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-300x113.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-768x290.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-830x313.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-230x87.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-350x132.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65-480x181.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-65.png 1236w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/figure><\/div>\n\n\n\n<p>\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528Fluentd\u7684\u63d2\u4ef6\uff08fluent-plugin-elasticsearch\uff09\u76f4\u63a5\u5c06\u65e5\u5fd7\u53d1\u9001\u7ed9 Elasticsearch\uff0c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u66ff\u6362\u6389Filebeat\uff0c\u4ece\u800c\u5f62\u6210Fluentd =&gt; ElasticSearch =&gt; Kibana \u7684\u67b6\u6784\uff0c\u4e5f\u79f0\u4f5cEFK\u3002<\/p>\n\n\n\n<p><strong>5.2 \u8fd0\u884cFluentd<\/strong><\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u901a\u8fc7\u5bb9\u5668\u6765\u8fd0\u884c\u4e00\u4e2aFluentd\u91c7\u96c6\u5668\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -d -p 24224:24224 -p 24224:24224\/udp -v \/edc\/fluentd\/log:\/fluentd\/log fluent\/fluentd<\/pre>\n\n\n\n<p>\u9ed8\u8ba4Fluentd\u4f1a\u4f7f\u752824224\u7aef\u53e3\uff0c\u5176\u65e5\u5fd7\u4f1a\u6536\u96c6\u5728\u6211\u4eec\u6620\u5c04\u7684\u8def\u5f84\u4e0b\u3002<\/p>\n\n\n\n<p>\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u4fee\u6539Filebeat\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5c06\/edc\/fluentd\/log\u52a0\u5165\u76d1\u63a7\u76ee\u5f55\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#=========================== Filebeat inputs =============================\n\nfilebeat.inputs:\n\n# Each - is an input. Most options can be set at the input level, so\n# you can use different inputs for various configurations.\n# Below are the input specific configurations.\n\n- type: log\n\n  # Change to true to enable this input configuration.\n  enabled: true\n\n  # Paths that should be crawled and fetched. Glob based paths.\n  paths:\n    - \/edc\/fluentd\/log\/*.log<\/pre>\n\n\n\n<p>\u6dfb\u52a0\u76d1\u63a7\u914d\u7f6e\u4e4b\u540e\uff0c\u9700\u8981\u91cd\u65b0restart\u4e00\u4e0bfilebeat\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl restart filebeat<\/pre>\n\n\n\n<p><strong>5.3 \u8fd0\u884c\u6d4b\u8bd5\u5bb9\u5668<\/strong><\/p>\n\n\n\n<p>\u4e3a\u4e86\u9a8c\u8bc1\u6548\u679c\uff0c\u8fd9\u91cc\u6211\u4eecRun\u4e24\u4e2a\u5bb9\u5668\uff0c\u5e76\u5206\u522b\u5236\u5b9a\u5176log-dirver\u4e3afluentd\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -d \\\n           --log-driver=fluentd \\\n           --log-opt fluentd-address=localhost:24224 \\\n           --log-opt tag=\"test-docker-A\" \\\n           busybox sh -c 'while true; do echo \"This is a log message from container A\"; sleep 10; done;'\n\ndocker run -d \\\n           --log-driver=fluentd \\\n           --log-opt fluentd-address=localhost:24224 \\\n           --log-opt tag=\"test-docker-B\" \\\n           busybox sh -c 'while true; do echo \"This is a log message from container B\"; sleep 10; done;'<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u901a\u8fc7\u6307\u5b9a\u5bb9\u5668\u7684log-driver\uff0c\u4ee5\u53ca\u4e3a\u6bcf\u4e2a\u5bb9\u5668\u8bbe\u7acb\u4e86tag\uff0c\u65b9\u4fbf\u6211\u4eec\u540e\u9762\u9a8c\u8bc1\u67e5\u770b\u65e5\u5fd7\u3002<\/p>\n\n\n\n<p><strong>5.4 \u9a8c\u8bc1EFK\u6548\u679c<\/strong><\/p>\n\n\n\n<p>\u8fd9\u65f6\u518d\u6b21\u8fdb\u5165Kibana\u4e2d\u67e5\u770b\u65e5\u5fd7\u4fe1\u606f\uff0c\u4fbf\u53ef\u4ee5\u901a\u8fc7\u521a\u521a\u8bbe\u7f6e\u7684tag\u4fe1\u606f\u7b5b\u9009\u5230\u521a\u521a\u6dfb\u52a0\u7684\u5bb9\u5668\u7684\u65e5\u5fd7\u4fe1\u606f\u4e86\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-1024x561.png\" alt=\"\" class=\"wp-image-11743\" width=\"527\" height=\"289\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-1024x561.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-300x164.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-768x421.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-830x454.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-230x126.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-350x192.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66-480x263.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-66.png 1388w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u516d\u3001\u5c0f\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u672c\u6587\u4eceELK\u7684\u57fa\u672c\u7ec4\u6210\u5165\u624b\uff0c\u4ecb\u7ecd\u4e86ELK\u7684\u57fa\u672c\u5904\u7406\u6d41\u7a0b\uff0c\u4ee5\u53ca\u4ece0\u5f00\u59cb\u642d\u5efa\u4e86\u4e00\u4e2aELK\u73af\u5883\uff0c\u6f14\u793a\u4e86\u57fa\u4e8eFilebeat\u6536\u96c6\u5bb9\u5668\u65e5\u5fd7\u4fe1\u606f\u7684\u6848\u4f8b\u3002\u7136\u540e\uff0c\u901a\u8fc7\u5f15\u5165Fluentd\u8fd9\u4e2a\u5f00\u6e90\u6570\u636e\u6536\u96c6\u5668\uff0c\u6f14\u793a\u4e86\u5982\u4f55\u57fa\u4e8eEFK\u7684\u65e5\u5fd7\u6536\u96c6\u6848\u4f8b\u3002\u5f53\u7136\uff0cELK\/EFK\u6709\u5f88\u591a\u7684\u77e5\u8bc6\u70b9\uff0c\u7b14\u8005\u4e5f\u8fd8\u53ea\u662f\u521d\u6b65\u4f7f\u7528\uff0c\u5e0c\u671b\u672a\u6765\u80fd\u591f\u5206\u4eab\u66f4\u591a\u7684\u5b9e\u8df5\u603b\u7ed3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1ahttps:\/\/www.cnblogs.com\/edisonchou\/p\/docker_logs_stu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11725"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11725"}],"version-history":[{"count":3,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11725\/revisions"}],"predecessor-version":[{"id":11930,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11725\/revisions\/11930"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}