{"id":32938,"date":"2025-04-26T08:20:24","date_gmt":"2025-04-26T00:20:24","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/32938.html"},"modified":"2025-04-26T08:20:24","modified_gmt":"2025-04-26T00:20:24","slug":"elk%e5%a6%82%e4%bd%95%e6%94%b6%e9%9b%86%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%bf%90%e8%a1%8c%e6%97%a5%e5%bf%97%ef%bc%9f%e5%88%b0%e5%ba%95%e6%98%af%e5%b9%b2%e4%bb%80%e4%b9%88%e7%9a%84%ef%bc%9f%e5%88%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/32938.html","title":{"rendered":"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f"},"content":{"rendered":"<h4>ELK\u662f\u4ec0\u4e48\u4ee5\u53ca\u5b83\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\u7684\u4f5c\u7528<\/h4>\n<p>ELK\u662f\u7531Elasticsearch\u3001Logstash\u548cKibana\u4e09\u4e2a\u5de5\u5177\u7ec4\u6210\u7684\u4e00\u5957\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u548c\u5206\u6790\u5e73\u53f0\u3002\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\u5c31\u50cf\u662f\u7ed9\u670d\u52a1\u5668\u8bf7\u4e86\u4e2a\u201c\u5c0f\u79d8\u4e66\u201d&#xff0c;\u80fd\u628a\u670d\u52a1\u5668\u5e72\u7684\u4e8b\u513f\u90fd\u8bb0\u5f55\u4e0b\u6765\u3002\u8fd9\u4e9b\u65e5\u5fd7\u91cc\u85cf\u7740\u5f88\u591a\u6709\u7528\u7684\u4fe1\u606f&#xff0c;\u6bd4\u5982\u670d\u52a1\u5668\u5565\u65f6\u5019\u5fd9\u5565\u65f6\u5019\u95f2&#xff0c;\u6709\u6ca1\u6709\u51fa\u5565\u6bdb\u75c5&#xff0c;\u7528\u6237\u90fd\u5e72\u4e86\u5565\u64cd\u4f5c\u3002\u6709\u4e86ELK&#xff0c;\u6211\u4eec\u5c31\u80fd\u628a\u8fd9\u4e9b\u65e5\u5fd7\u6574\u7406\u597d\u3001\u5206\u6790\u597d&#xff0c;\u8fd9\u6837\u5c31\u80fd\u8ba9\u670d\u52a1\u5668\u66f4\u597d\u5730\u5de5\u4f5c&#xff0c;\u8fd8\u80fd\u53ca\u65f6\u53d1\u73b0\u5e76\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<h4>\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u548c\u8ba1\u7b97\u673a\u786c\u4ef6\u7684\u4ea4\u4e92<\/h4>\n<ul>\n<li>\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ea4\u4e92&#xff1a;Logstash\u8fd9\u4e2a\u7ec4\u4ef6\u5c31\u50cf\u4e2a\u52e4\u52b3\u7684\u5c0f\u871c\u8702&#xff0c;\u5b83\u80fd\u8ddf\u64cd\u4f5c\u7cfb\u7edf\u8bf4\u201c\u6211\u8981\u62ff\u65e5\u5fd7\u6587\u4ef6\u5566\u201d&#xff0c;\u7136\u540e\u901a\u8fc7\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u63a5\u53e3&#xff0c;\u53bb\u6307\u5b9a\u7684\u6587\u4ef6\u5939\u91cc\u628a\u65e5\u5fd7\u6587\u4ef6\u62ff\u51fa\u6765\u3002Elasticsearch\u548cKibana\u4e5f\u4f1a\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u63a5\u53e3\u6765\u505a\u4e00\u4e9b\u4e8b\u513f&#xff0c;\u50cf\u8bfb\u6587\u4ef6\u3001\u5f00\u7f51\u7edc\u8fde\u63a5\u5565\u7684\u3002<\/li>\n<li>\u548c\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92&#xff1a;\u5b83\u4eec\u90fd\u5f97\u7528\u8ba1\u7b97\u673a\u7684\u786c\u4ef6\u8d44\u6e90\u3002Elasticsearch\u5206\u6790\u548c\u5b58\u50a8\u65e5\u5fd7\u7684\u65f6\u5019&#xff0c;\u4f1a\u7528CPU\u505a\u8ba1\u7b97&#xff0c;\u7528\u5185\u5b58\u6765\u4e34\u65f6\u5b58\u6570\u636e&#xff0c;\u7528\u786c\u76d8\u628a\u6570\u636e\u957f\u4e45\u4fdd\u5b58\u8d77\u6765\u3002Logstash\u6536\u96c6\u65e5\u5fd7\u4e5f\u5f97\u7528CPU\u548c\u5185\u5b58&#xff0c;Kibana\u5c55\u793a\u65e5\u5fd7\u6570\u636e\u7684\u65f6\u5019&#xff0c;\u4f1a\u901a\u8fc7\u663e\u5361\u628a\u6570\u636e\u53d8\u6210\u597d\u770b\u7684\u56fe\u8868\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u51fa\u6765\u3002<\/li>\n<\/ul>\n<h4>ELK\u5305\u542b\u7684\u90e8\u5206<\/h4>\n<ul>\n<li>Elasticsearch&#xff1a;\u5b83\u5c31\u50cf\u4e00\u4e2a\u8d85\u7ea7\u5927\u7684\u56fe\u4e66\u9986\u7ba1\u7406\u5458&#xff0c;\u628a\u65e5\u5fd7\u6570\u636e\u6574\u7406\u5f97\u4e95\u4e95\u6709\u6761&#xff0c;\u8fd8\u80fd\u8ba9\u6211\u4eec\u5feb\u901f\u627e\u5230\u60f3\u8981\u7684\u65e5\u5fd7\u3002\u5b83\u628a\u65e5\u5fd7\u6570\u636e\u5b58\u8d77\u6765&#xff0c;\u5efa\u597d\u591a\u7d22\u5f15&#xff0c;\u8fd9\u6837\u6211\u4eec\u641c\u65e5\u5fd7\u7684\u65f6\u5019\u5c31\u80fd\u5f88\u5feb\u51fa\u7ed3\u679c\u3002<\/li>\n<li>Logstash&#xff1a;\u662f\u4e2a\u65e5\u5fd7\u6536\u96c6\u5c0f\u80fd\u624b&#xff0c;\u5b83\u80fd\u4ece\u5404\u79cd\u5730\u65b9\u628a\u65e5\u5fd7\u6536\u96c6\u8fc7\u6765&#xff0c;\u50cf\u6587\u4ef6\u3001\u6570\u636e\u5e93\u5565\u7684\u3002\u5b83\u8fd8\u80fd\u628a\u6536\u96c6\u5230\u7684\u65e5\u5fd7\u6574\u7406\u4e00\u4e0b&#xff0c;\u53bb\u6389\u6ca1\u7528\u7684\u90e8\u5206&#xff0c;\u628a\u683c\u5f0f\u53d8\u5f97\u7edf\u4e00&#xff0c;\u7136\u540e\u518d\u628a\u65e5\u5fd7\u9001\u7ed9Elasticsearch\u3002<\/li>\n<li>Kibana&#xff1a;\u5c31\u50cf\u4e00\u4e2a\u753b\u5bb6&#xff0c;\u80fd\u628aElasticsearch\u91cc\u7684\u65e5\u5fd7\u6570\u636e\u53d8\u6210\u6f02\u4eae\u7684\u56fe\u8868\u3001\u62a5\u8868&#xff0c;\u8ba9\u6211\u4eec\u4e00\u773c\u5c31\u80fd\u770b\u61c2\u65e5\u5fd7\u91cc\u7684\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h4>\u80cc\u540e\u505a\u7684\u4e8b\u60c5<\/h4>\n<ul>\n<li>Logstash\u4f1a\u6309\u7167\u6211\u4eec\u5b9a\u597d\u7684\u89c4\u5219\u53bb\u6536\u96c6\u65e5\u5fd7\u3002\u5b83\u5148\u627e\u5230\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u7136\u540e\u4e00\u884c\u4e00\u884c\u5730\u8bfb\u91cc\u9762\u7684\u5185\u5bb9\u3002\u63a5\u7740&#xff0c;\u5b83\u4f1a\u7528\u4e00\u4e9b\u89c4\u5219\u6765\u68c0\u67e5\u548c\u4fee\u6539\u8fd9\u4e9b\u65e5\u5fd7&#xff0c;\u6bd4\u5982\u628a\u65e5\u671f\u683c\u5f0f\u53d8\u5f97\u4e00\u6837&#xff0c;\u628a\u4e00\u4e9b\u4e0d\u9700\u8981\u7684\u8bcd\u53bb\u6389\u3002\u5904\u7406\u5b8c\u540e&#xff0c;\u5b83\u5c31\u628a\u65e5\u5fd7\u6253\u5305\u9001\u7ed9Elasticsearch\u3002<\/li>\n<li>Elasticsearch\u6536\u5230\u65e5\u5fd7\u540e&#xff0c;\u4f1a\u7ed9\u5b83\u4eec\u5efa\u7d22\u5f15\u3002\u5c31\u50cf\u7ed9\u4e66\u8d34\u4e0a\u6807\u7b7e&#xff0c;\u8fd9\u6837\u6211\u4eec\u641c\u7684\u65f6\u5019\u5c31\u80fd\u5feb\u901f\u627e\u5230\u3002\u5b83\u628a\u65e5\u5fd7\u5b58\u5230\u786c\u76d8\u4e0a&#xff0c;\u8fd9\u6837\u6570\u636e\u5c31\u4e0d\u4f1a\u4e22\u5566\u3002<\/li>\n<li>\u5f53\u6211\u4eec\u60f3\u770b\u770b\u65e5\u5fd7\u91cc\u6709\u5565\u4fe1\u606f\u7684\u65f6\u5019&#xff0c;\u5c31\u6253\u5f00Kibana\u3002Kibana\u4f1a\u5411Elasticsearch\u53d1\u8bf7\u6c42&#xff0c;\u8bf4\u201c\u6211\u8981\u627e\u8fd9\u6837\u7684\u65e5\u5fd7\u201d\u3002Elasticsearch\u6536\u5230\u8bf7\u6c42\u540e&#xff0c;\u5c31\u5f00\u59cb\u5728\u5b83\u5b58\u7684\u65e5\u5fd7\u91cc\u627e&#xff0c;\u627e\u5230\u540e\u628a\u7ed3\u679c\u53d1\u7ed9Kibana\u3002Kibana\u518d\u628a\u8fd9\u4e9b\u7ed3\u679c\u53d8\u6210\u597d\u770b\u7684\u56fe\u8868\u3001\u62a5\u8868\u5c55\u793a\u7ed9\u6211\u4eec\u3002<\/li>\n<\/ul>\n<h4>\u4f7f\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u7f51\u7ad9\u76d1\u63a7&#xff1a;\u80fd\u770b\u770b\u7528\u6237\u5565\u65f6\u5019\u8bbf\u95ee\u7f51\u7ad9&#xff0c;\u8bbf\u95ee\u4e86\u54ea\u4e9b\u9875\u9762&#xff0c;\u8fd9\u6837\u5c31\u80fd\u77e5\u9053\u7f51\u7ad9\u54ea\u91cc\u53d7\u6b22\u8fce&#xff0c;\u54ea\u91cc\u9700\u8981\u6539\u8fdb\u3002<\/li>\n<li>\u670d\u52a1\u5668\u6027\u80fd\u76d1\u63a7&#xff1a;\u53ef\u4ee5\u77e5\u9053\u670d\u52a1\u5668\u7684CPU\u3001\u5185\u5b58\u3001\u786c\u76d8\u7528\u5f97\u548b\u6837&#xff0c;\u8981\u662f\u53d1\u73b0\u6709\u95ee\u9898\u80fd\u8d76\u7d27\u89e3\u51b3\u3002<\/li>\n<li>\u5b89\u5168\u5ba1\u8ba1&#xff1a;\u67e5\u770b\u6709\u6ca1\u6709\u5f02\u5e38\u7684\u767b\u5f55\u3001\u64cd\u4f5c&#xff0c;\u80fd\u53ca\u65f6\u53d1\u73b0\u53ef\u80fd\u7684\u5b89\u5168\u5a01\u80c1\u3002<\/li>\n<\/ul>\n<h4>\u5e95\u5c42\u539f\u7406<\/h4>\n<ul>\n<li>Elasticsearch&#xff1a;\u7528\u5012\u6392\u7d22\u5f15\u7684\u539f\u7406\u3002\u5c31\u50cf\u5b57\u5178\u4e00\u6837&#xff0c;\u628a\u65e5\u5fd7\u91cc\u7684\u5173\u952e\u8bcd\u548c\u5bf9\u5e94\u7684\u65e5\u5fd7\u5173\u8054\u8d77\u6765\u3002\u6211\u4eec\u641c\u5173\u952e\u8bcd\u7684\u65f6\u5019&#xff0c;\u5b83\u80fd\u5feb\u901f\u627e\u5230\u5305\u542b\u8fd9\u4e2a\u5173\u952e\u8bcd\u7684\u65e5\u5fd7\u3002\u5b83\u8fd8\u80fd\u7528\u5206\u5e03\u5f0f\u5b58\u50a8&#xff0c;\u628a\u6570\u636e\u5206\u6563\u5b58\u5230\u597d\u591a\u670d\u52a1\u5668\u4e0a&#xff0c;\u8fd9\u6837\u53c8\u5b89\u5168\u53c8\u5feb\u3002<\/li>\n<li>Logstash&#xff1a;\u57fa\u4e8e\u4e8b\u4ef6\u9a71\u52a8\u3002\u6709\u65b0\u7684\u65e5\u5fd7\u4ea7\u751f\u65f6&#xff0c;\u5c31\u4f1a\u89e6\u53d1\u4e00\u4e2a\u4e8b\u4ef6&#xff0c;\u7136\u540e\u5b83\u5c31\u6309\u7167\u6211\u4eec\u5b9a\u7684\u89c4\u5219\u5904\u7406\u8fd9\u4e2a\u65e5\u5fd7\u3002\u5b83\u7528\u5404\u79cd\u63d2\u4ef6\u6765\u5b8c\u6210\u4e0d\u540c\u7684\u4efb\u52a1&#xff0c;\u50cf\u8f93\u5165\u63d2\u4ef6\u8d1f\u8d23\u62ff\u65e5\u5fd7&#xff0c;\u8fc7\u6ee4\u63d2\u4ef6\u8d1f\u8d23\u6539\u65e5\u5fd7&#xff0c;\u8f93\u51fa\u63d2\u4ef6\u8d1f\u8d23\u628a\u65e5\u5fd7\u9001\u51fa\u53bb\u3002<\/li>\n<li>Kibana&#xff1a;\u901a\u8fc7\u548cElasticsearch\u7684API\u4ea4\u6d41\u6765\u83b7\u53d6\u6570\u636e\u3002\u5b83\u7528\u524d\u7aef\u6280\u672f&#xff0c;\u50cfHTML\u3001CSS\u3001JavaScript\u6765\u505a\u51fa\u597d\u770b\u7684\u754c\u9762\u548c\u56fe\u8868\u3002<\/li>\n<\/ul>\n<h4>\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5<\/h4>\n<ul>\n<li>\u6570\u636e\u7ed3\u6784&#xff1a;Elasticsearch\u91cc\u7528JSON\u683c\u5f0f\u6765\u5b58\u65e5\u5fd7\u6570\u636e&#xff0c;\u8fd9\u5c31\u50cf\u4e00\u4e2a\u5927\u7bb1\u5b50&#xff0c;\u91cc\u9762\u88c5\u7740\u5f88\u591a\u5c0f\u76d2\u5b50&#xff0c;\u6bcf\u4e2a\u5c0f\u76d2\u5b50\u90fd\u6709\u4e2a\u540d\u5b57\u548c\u5bf9\u5e94\u7684\u5185\u5bb9\u3002\u6bd4\u5982\u4e00\u4e2a\u65e5\u5fd7\u53ef\u80fd\u5b58\u6210\u8fd9\u6837&#xff1a;<\/li>\n<\/ul>\n<p><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;timestamp&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;2024-01-01 12:00:00&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;message&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u7528\u6237\u767b\u5f55\u6210\u529f&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;user&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">&#034;\u5c0f\u660e&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>\u7b97\u6cd5&#xff1a;Elasticsearch\u5728\u641c\u7d22\u7684\u65f6\u5019\u4f1a\u7528\u5e03\u5c14\u641c\u7d22\u7b97\u6cd5&#xff0c;\u80fd\u6839\u636e\u6211\u4eec\u7684\u641c\u7d22\u6761\u4ef6&#xff0c;\u50cf\u201c\u5305\u542b\u8fd9\u4e2a\u8bcd\u201d\u201c\u4e0d\u5305\u542b\u90a3\u4e2a\u8bcd\u201d&#xff0c;\u5feb\u901f\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u65e5\u5fd7\u3002Logstash\u5728\u5904\u7406\u65e5\u5fd7\u7684\u65f6\u5019\u4f1a\u7528\u5b57\u7b26\u4e32\u5339\u914d\u7b97\u6cd5&#xff0c;\u770b\u770b\u65e5\u5fd7\u91cc\u6709\u6ca1\u6709\u7279\u5b9a\u7684\u8bcd\u3002<\/li>\n<\/ul>\n<h4>\u4ee3\u7801\u793a\u4f8b<\/h4>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684Logstash\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b&#xff0c;\u7528\u6765\u6536\u96c6\u670d\u52a1\u5668\u7684\u65e5\u5fd7\u6587\u4ef6\u5e76\u9001\u5230Elasticsearch&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u8f93\u5165\u90e8\u5206&#xff0c;\u544a\u8bc9Logstash\u4ece\u54ea\u91cc\u62ff\u65e5\u5fd7<\/span><br \/>\ninput <span class=\"token punctuation\">{<\/span><br \/>\n  file <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\"># \u65e5\u5fd7\u6587\u4ef6\u7684\u8def\u5f84&#xff0c;\u8fd9\u91cc\u8981\u6539\u6210\u4f60\u5b9e\u9645\u7684\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84<\/span><br \/>\n    path <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#034;\/var\/log\/syslog&#034;<\/span><br \/>\n    <span class=\"token comment\"># \u4ece\u6587\u4ef6\u5f00\u5934\u5f00\u59cb\u8bfb<\/span><br \/>\n    start_position <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#034;beginning&#034;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># \u8fc7\u6ee4\u90e8\u5206&#xff0c;\u5bf9\u65e5\u5fd7\u8fdb\u884c\u5904\u7406<\/span><br \/>\nfilter <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token comment\"># \u7528grok\u63d2\u4ef6\u6765\u89e3\u6790\u65e5\u5fd7\u5185\u5bb9<\/span><br \/>\n  grok <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\"># \u5339\u914d\u65e5\u5fd7\u7684\u683c\u5f0f&#xff0c;\u8fd9\u91cc\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50&#xff0c;\u8981\u6839\u636e\u5b9e\u9645\u65e5\u5fd7\u683c\u5f0f\u4fee\u6539<\/span><br \/>\n    match <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string\">&#034;message&#034;<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#034;%{TIMESTAMP_ISO8601:timestamp} %{WORD:log_level} %{GREEDYDATA:message}&#034;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># \u8f93\u51fa\u90e8\u5206&#xff0c;\u628a\u5904\u7406\u540e\u7684\u65e5\u5fd7\u9001\u5230\u54ea\u91cc<\/span><br \/>\noutput <span class=\"token punctuation\">{<\/span><br \/>\n  elasticsearch <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\"># Elasticsearch\u7684\u5730\u5740\u548c\u7aef\u53e3<\/span><br \/>\n    hosts <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;localhost:9200&#034;<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token comment\"># \u5b58\u5230Elasticsearch\u91cc\u7684\u7d22\u5f15\u540d\u5b57<\/span><br \/>\n    index <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token string\">&#034;server_logs&#034;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>\u4ee3\u7801\u89e3\u91ca<\/h5>\n<ul>\n<li>input\u90e8\u5206&#xff1a;file\u63d2\u4ef6\u8868\u793a\u4ece\u6587\u4ef6\u91cc\u62ff\u65e5\u5fd7&#xff0c;path\u6307\u5b9a\u4e86\u65e5\u5fd7\u6587\u4ef6\u7684\u8def\u5f84&#xff0c;start_position\u8bbe\u7f6e\u4ece\u6587\u4ef6\u5f00\u5934\u5f00\u59cb\u8bfb\u3002<\/li>\n<li>filter\u90e8\u5206&#xff1a;grok\u63d2\u4ef6\u80fd\u628a\u65e5\u5fd7\u5185\u5bb9\u6309\u7167\u6211\u4eec\u5b9a\u7684\u683c\u5f0f\u62c6\u5f00\u3002match\u91cc\u7684\u89c4\u5219\u80fd\u628a\u65e5\u5fd7\u5206\u6210\u65f6\u95f4\u6233\u3001\u65e5\u5fd7\u7ea7\u522b\u548c\u65e5\u5fd7\u6d88\u606f\u4e09\u90e8\u5206\u3002<\/li>\n<li>output\u90e8\u5206&#xff1a;elasticsearch\u63d2\u4ef6\u628a\u5904\u7406\u540e\u7684\u65e5\u5fd7\u9001\u5230Elasticsearch\u3002hosts\u662fElasticsearch\u7684\u5730\u5740\u548c\u7aef\u53e3&#xff0c;index\u662f\u5b58\u65e5\u5fd7\u7684\u7d22\u5f15\u540d\u5b57\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb799\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf16\u6b21\u3002ELK\u662f\u7531Elasticsearch\u3001Logstash\u548cKibana\u4e09\u4e2a\u5de5\u5177\u7ec4\u6210\u7684\u4e00\u5957\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u548c\u5206\u6790\u5e73\u53f0\u3002\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\u5c31\u50cf\u662f\u7ed9\u670d\u52a1\u5668\u8bf7\u4e86\u4e2a\u201c\u5c0f\u79d8\u4e66\u201d\uff0c\u80fd\u628a\u670d\u52a1\u5668\u5e72\u7684\u4e8b\u513f\u90fd\u8bb0\u5f55\u4e0b\u6765\u3002\u8fd9\u4e9b\u65e5\u5fd7\u91cc\u85cf\u7740\u5f88\u591a\u6709\u7528\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u670d\u52a1\u5668\u5565\u65f6\u5019\u5fd9\u5565\u65f6\u5019\u95f2\uff0c\u6709\u6ca1\u6709\u51fa\u5565\u6bdb\u75c5\uff0c\u7528\u6237\u90fd\u5e72\u4e86\u5565\u64cd\u4f5c\u3002\u6709\u4e86ELK\uff0c\u6211\u4eec\u5c31\u80fd\u628a\u8fd9\u4e9b\u65e5\u5fd7\u6574\u7406\u597d\u3001\u5206\u6790\u597d\uff0c\u8fd9\u6837\u5c31\u80fd\u8ba9\u670d\u52a1\u5668\u66f4\u597d\u5730\u5de5\u4f5c\uff0c\u8fd8\u80fd\u53ca\u65f6\u53d1\u73b0\u5e76\u89e3\u51b3\u95ee\u9898\u3002<\/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":[1299,2296,1666,43],"topic":[],"class_list":["post-32938","post","type-post","status-publish","format-standard","hentry","category-server","tag-elasticsearch","tag-elk","tag-1666","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \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\/32938.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb799\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf16\u6b21\u3002ELK\u662f\u7531Elasticsearch\u3001Logstash\u548cKibana\u4e09\u4e2a\u5de5\u5177\u7ec4\u6210\u7684\u4e00\u5957\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u548c\u5206\u6790\u5e73\u53f0\u3002\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\u5c31\u50cf\u662f\u7ed9\u670d\u52a1\u5668\u8bf7\u4e86\u4e2a\u201c\u5c0f\u79d8\u4e66\u201d\uff0c\u80fd\u628a\u670d\u52a1\u5668\u5e72\u7684\u4e8b\u513f\u90fd\u8bb0\u5f55\u4e0b\u6765\u3002\u8fd9\u4e9b\u65e5\u5fd7\u91cc\u85cf\u7740\u5f88\u591a\u6709\u7528\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u670d\u52a1\u5668\u5565\u65f6\u5019\u5fd9\u5565\u65f6\u5019\u95f2\uff0c\u6709\u6ca1\u6709\u51fa\u5565\u6bdb\u75c5\uff0c\u7528\u6237\u90fd\u5e72\u4e86\u5565\u64cd\u4f5c\u3002\u6709\u4e86ELK\uff0c\u6211\u4eec\u5c31\u80fd\u628a\u8fd9\u4e9b\u65e5\u5fd7\u6574\u7406\u597d\u3001\u5206\u6790\u597d\uff0c\u8fd9\u6837\u5c31\u80fd\u8ba9\u670d\u52a1\u5668\u66f4\u597d\u5730\u5de5\u4f5c\uff0c\u8fd8\u80fd\u53ca\u65f6\u53d1\u73b0\u5e76\u89e3\u51b3\u95ee\u9898\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/32938.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-26T00:20:24+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=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/32938.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/32938.html\",\"name\":\"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-26T00:20:24+00:00\",\"dateModified\":\"2025-04-26T00:20:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/32938.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/32938.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/32938.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f\"}]},{\"@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":"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \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\/32938.html","og_locale":"zh_CN","og_type":"article","og_title":"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb799\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf16\u6b21\u3002ELK\u662f\u7531Elasticsearch\u3001Logstash\u548cKibana\u4e09\u4e2a\u5de5\u5177\u7ec4\u6210\u7684\u4e00\u5957\u5f3a\u5927\u7684\u65e5\u5fd7\u7ba1\u7406\u548c\u5206\u6790\u5e73\u53f0\u3002\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\u5c31\u50cf\u662f\u7ed9\u670d\u52a1\u5668\u8bf7\u4e86\u4e2a\u201c\u5c0f\u79d8\u4e66\u201d\uff0c\u80fd\u628a\u670d\u52a1\u5668\u5e72\u7684\u4e8b\u513f\u90fd\u8bb0\u5f55\u4e0b\u6765\u3002\u8fd9\u4e9b\u65e5\u5fd7\u91cc\u85cf\u7740\u5f88\u591a\u6709\u7528\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u670d\u52a1\u5668\u5565\u65f6\u5019\u5fd9\u5565\u65f6\u5019\u95f2\uff0c\u6709\u6ca1\u6709\u51fa\u5565\u6bdb\u75c5\uff0c\u7528\u6237\u90fd\u5e72\u4e86\u5565\u64cd\u4f5c\u3002\u6709\u4e86ELK\uff0c\u6211\u4eec\u5c31\u80fd\u628a\u8fd9\u4e9b\u65e5\u5fd7\u6574\u7406\u597d\u3001\u5206\u6790\u597d\uff0c\u8fd9\u6837\u5c31\u80fd\u8ba9\u670d\u52a1\u5668\u66f4\u597d\u5730\u5de5\u4f5c\uff0c\u8fd8\u80fd\u53ca\u65f6\u53d1\u73b0\u5e76\u89e3\u51b3\u95ee\u9898\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/32938.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-26T00:20:24+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/32938.html","url":"https:\/\/www.wsisp.com\/helps\/32938.html","name":"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-26T00:20:24+00:00","dateModified":"2025-04-26T00:20:24+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/32938.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/32938.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/32938.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"ELK\u5982\u4f55\u6536\u96c6\u670d\u52a1\u5668\u8fd0\u884c\u65e5\u5fd7\uff1f\u5230\u5e95\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u5230\u5e95\u662f\u5982\u4f55\u548c\u64cd\u4f5c\u7cfb\u7edf\u4ee5\u53ca\u8ba1\u7b97\u673a\u786c\u4ef6\u4ea4\u4e92\u7684\uff1f\u4e00\u5171\u5305\u542b\u54ea\u4e9b\u90e8\u5206\uff1f"}]},{"@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\/32938","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=32938"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/32938\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=32938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=32938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=32938"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=32938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}