{"id":16373,"date":"2023-12-05T10:18:20","date_gmt":"2023-12-05T02:18:20","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=16373"},"modified":"2023-12-16T11:47:05","modified_gmt":"2023-12-16T03:47:05","slug":"elasticsearch-zhong-deingest-jie-dian-ru-he-gong-z","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/05\/elasticsearch-zhong-deingest-jie-dian-ru-he-gong-z\/","title":{"rendered":"Elasticsearch\u4e2d\u7684Ingest\u8282\u70b9\u5982\u4f55\u5de5\u4f5c\uff1f"},"content":{"rendered":"<p>\u5728Elasticsearch\u4e2d\uff0cIngest\u8282\u70b9\u662f\u8d1f\u8d23\u6570\u636e\u9884\u5904\u7406\u7684\u8282\u70b9\uff0c\u5b83\u5141\u8bb8\u4f60\u5728\u5c06\u6570\u636e\u7d22\u5f15\u5230Elasticsearch\u4e4b\u524d\u5bf9\u6570\u636e\u8fdb\u884c\u8f6c\u6362\u3001\u4e30\u5bcc\u6216\u91cd\u5851\u3002Ingest\u8282\u70b9\u4f7f\u7528Ingest Pipeline\uff08\u7ba1\u9053\uff09\u6765\u5b9a\u4e49\u4e00\u7cfb\u5217\u7684\u5904\u7406\u6b65\u9aa4\uff0c\u8fd9\u4e9b\u6b65\u9aa4\u53ef\u4ee5\u5305\u62ec\u5904\u7406\u6587\u672c\u3001\u89e3\u6790\u65e5\u671f\u3001\u63d0\u53d6\u5b57\u6bb5\u7b49\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662fIngest\u8282\u70b9\u7684\u5de5\u4f5c\u539f\u7406\uff1a<\/p>\n<ol>\n<li>\n<strong>\u5b9a\u4e49Ingest Pipeline\uff1a<\/strong><\/p>\n<ul>\n<li>\u7528\u6237\u5728Elasticsearch\u4e2d\u5b9a\u4e49Ingest Pipeline\uff0c\u4e00\u4e2aPipeline\u7531\u4e00\u7cfb\u5217\u5904\u7406\u5668\uff08Processors\uff09\u7ec4\u6210\uff0c\u6bcf\u4e2a\u5904\u7406\u5668\u6267\u884c\u4e00\u4e2a\u5177\u4f53\u7684\u64cd\u4f5c\u3002\u8fd9\u4e9b\u64cd\u4f5c\u53ef\u4ee5\u5305\u62ecGroovy\u811a\u672c\u3001\u65e5\u671f\u89e3\u6790\u3001\u5206\u5272\u5b57\u6bb5\u7b49\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">PUT _ingest\/pipeline\/my_pipeline\n{\n  &quot;processors&quot;: [\n    {\n      &quot;grok&quot;: {\n        &quot;field&quot;: &quot;message&quot;,\n        &quot;patterns&quot;: [&quot;%{COMBINEDAPACHELOG}&quot;]\n      }\n    },\n    {\n      &quot;date&quot;: {\n        &quot;field&quot;: &quot;timestamp&quot;,\n        &quot;formats&quot;: [&quot;dd\/MMM\/yyyy:HH:mm:ss Z&quot;]\n      }\n    }\n  ]\n}\n<\/code><\/pre>\n<\/li>\n<li>\n<strong>\u5e94\u7528Ingest Pipeline\uff1a<\/strong><\/p>\n<ul>\n<li>\u5f53\u7d22\u5f15\u6587\u6863\u5230Elasticsearch\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u5728\u7d22\u5f15\u8bf7\u6c42\u4e2d\u6307\u5b9a<code>pipeline<\/code>\u53c2\u6570\u6765\u5e94\u7528Ingest Pipeline\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-json\">POST my_index\/_doc\/1?pipeline=my_pipeline\n{\n  &quot;message&quot;: &quot;192.168.0.1 - - [22\/Dec\/2023:10:00:00 +0000] \\&quot;GET \/index.html\\&quot; 200 1234&quot;\n}\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\uff0cIngest Pipeline\u4f1a\u5bf9<code>message<\/code>\u5b57\u6bb5\u6267\u884cGrok\u6a21\u5f0f\u5339\u914d\u548c\u65e5\u671f\u89e3\u6790\uff0c\u5c06\u5176\u8f6c\u6362\u6210\u7ed3\u6784\u5316\u7684\u5b57\u6bb5\u3002\n<\/li>\n<li>\n<strong>Ingest\u8282\u70b9\u5904\u7406\u8fc7\u7a0b\uff1a<\/strong><\/p>\n<ul>\n<li>\u5f53\u7d22\u5f15\u8bf7\u6c42\u5230\u8fbeIngest\u8282\u70b9\u65f6\uff0cIngest\u8282\u70b9\u4f1a\u5c06\u6587\u6863\u9001\u5165\u6307\u5b9a\u7684Ingest Pipeline\u3002\u6587\u6863\u5c06\u6309\u7167Pipeline\u4e2d\u5b9a\u4e49\u7684\u5904\u7406\u5668\u987a\u5e8f\u6267\u884c\u76f8\u5e94\u7684\u8f6c\u6362\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5904\u7406\u5668\u6267\u884c\uff1a<\/strong><\/p>\n<ul>\n<li>\u6bcf\u4e2a\u5904\u7406\u5668\u6839\u636e\u5176\u5b9a\u4e49\u5bf9\u6587\u6863\u8fdb\u884c\u5904\u7406\u3002\u4f8b\u5982\uff0c\u4e00\u4e2a\u5904\u7406\u5668\u53ef\u80fd\u4f1a\u5c06\u6587\u672c\u5b57\u6bb5\u5206\u5272\u6210\u591a\u4e2a\u5b57\u6bb5\uff0c\u89e3\u6790\u65e5\u671f\u5b57\u6bb5\uff0c\u6216\u8005\u6267\u884c\u5176\u4ed6\u5b9a\u5236\u7684\u8f6c\u6362\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u6587\u6863\u8f6c\u6362\u5b8c\u6210\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u7ecf\u8fc7\u6240\u6709\u5904\u7406\u5668\u7684\u5904\u7406\u540e\uff0c\u6587\u6863\u7684\u8f6c\u6362\u8fc7\u7a0b\u5b8c\u6210\u3002\u8f6c\u6362\u540e\u7684\u6587\u6863\u5c06\u88ab\u7d22\u5f15\u5230Elasticsearch\u4e2d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7Ingest\u8282\u70b9\u548cIngest Pipeline\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u5c06\u6570\u636e\u7d22\u5f15\u5230Elasticsearch\u4e4b\u524d\uff0c\u5bf9\u539f\u59cb\u6570\u636e\u8fdb\u884c\u7075\u6d3b\u7684\u9884\u5904\u7406\u3002\u8fd9\u79cd\u9884\u5904\u7406\u80fd\u529b\u5bf9\u4e8e\u5c06\u539f\u59cb\u65e5\u5fd7\u6570\u636e\u8f6c\u6362\u4e3a\u7ed3\u6784\u5316\u6570\u636e\u3001\u63d0\u53d6\u5173\u952e\u4fe1\u606f\u7b49\u573a\u666f\u975e\u5e38\u6709\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Elasticsearch\u4e2d\uff0cIngest\u8282\u70b9\u662f\u8d1f\u8d23\u6570\u636e\u9884\u5904\u7406\u7684\u8282\u70b9\uff0c\u5b83\u5141\u8bb8\u4f60\u5728\u5c06\u6570\u636e\u7d22\u5f15\u5230Elastics [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125],"tags":[],"class_list":["post-16373","post","type-post","status-publish","format-standard","hentry","category-elasticsearch"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=16373"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16373\/revisions"}],"predecessor-version":[{"id":48442,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/16373\/revisions\/48442"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=16373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=16373"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=16373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}