{"id":41164,"date":"2023-12-10T19:17:35","date_gmt":"2023-08-17T09:37:08","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/"},"modified":"2024-01-15T10:52:14","modified_gmt":"2024-01-15T02:52:14","slug":"%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/","title":{"rendered":"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5"},"content":{"rendered":"<p>\u8fde\u63a5\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u5f88\u56f0\u96be\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a\u5f53\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5f88\u96be\u5224\u65ad\u662f\u54ea\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u51fa\u9519\u4e86\u3002<br \/>\n\u56e0\u6b64\uff0c\u5728\u8fde\u63a5td-agent(fluentd)\u548celasticsearch\u65f6\uff0c\u6211\u5c06\u63d0\u4f9b\u8f93\u5165\u7684\u547d\u4ee4\u3002<br \/>\n\u5047\u8bbe\u4ee5logstash\u7684\u683c\u5f0f\u5c06\u65e5\u5fd7\u53d1\u9001\u5230elasticsearch\uff0clogstash\u7684\u524d\u7f00\u4e3atest\uff0c\u65f6\u95f4\u4e3a2015\u5e749\u67088\u65e5\u3002<\/p>\n<h2>&#8220;Elasticsearch\u7684\u8c03\u8bd5\u529f\u80fd&#8221; (Elasticsearch&#8217;s debugging feature)<\/h2>\n<h3>1. \u5c3e\u968f Elasticsearch \u7684\u65e5\u5fd7<\/h3>\n<pre class=\"post-pre\"><code>tail -f \/var\/log\/elasticsearch\/elasticsearch.log\r\n<\/code><\/pre>\n<h3>\u786e\u8ba4\u662f\u5426\u5df2\u7ecf\u5728 elasticsearch \u4e2d\u6ce8\u518c\u4e86\u8bb0\u5f55\u3002<\/h3>\n<p>\u786e\u8ba4\u5728 elasticsearch \u4e2d\u662f\u5426\u5df2\u7ecf\u6dfb\u52a0\u4e86\u8bb0\u5f55\u3002<\/p>\n<p>\u68c0\u67e5\u662f\u5426\u5df2\u5728 elasticsearch \u4e2d\u6ce8\u518c\u4e86\u8bb0\u5f55\u3002<\/p>\n<p>\u786e\u8ba4\u5728 elasticsearch \u4e2d\u662f\u5426\u6709\u8bb0\u5f55\u6ce8\u518c\u3002<\/p>\n<p>\u9996\u5148\uff0c\u786e\u8ba4\u7d22\u5f15\uff08\u5728\u6570\u636e\u5e93\u4e2d\u79f0\u4e3a\u8868\uff09\u662f\u5426\u5df2\u521b\u5efa\u3002<\/p>\n<pre class=\"post-pre\"><code>curl 'localhost:9200\/_cat\/indices?v'\r\n<\/code><\/pre>\n<p>\u786e\u8ba4\u662f\u5426\u6709\u5531\u7247\u3002<\/p>\n<pre class=\"post-pre\"><code>curl 'localhost:9200\/test-2015.09.08\/_search?q=*&amp;pretty'\r\n<\/code><\/pre>\n<h2>td-agent\u7684\u8c03\u8bd5<\/h2>\n<h3>1. \u5c06 td-agent \u4ee5\u8c03\u8bd5\u6a21\u5f0f\u542f\u52a8\u3002<\/h3>\n<pre class=\"post-pre\"><code>sudo td-agent -vv\r\n<\/code><\/pre>\n<p>\/var\/log\/td-agent\/td-agent.log\u6587\u4ef6\u4e5f\u4f1a\u8bb0\u5f55\u65e5\u5fd7\uff0c\u4f46\u8981\u60f3\u8f93\u51fa\u66f4\u8be6\u7ec6\u7684\u65e5\u5fd7\u65f6\uff0c\u6700\u597d\u5148\u505c\u6b62\u5b88\u62a4\u8fdb\u7a0b\uff0c\u7136\u540e\u4f7f\u7528\u4e0a\u8ff0\u547d\u4ee4\u542f\u52a8\u3002<\/p>\n<h2>\u6211\u9677\u5165\u4e86\u81ea\u5df1\u7684\u56f0\u5883\u3002<\/h2>\n<p>\u5728td-agent\u4e2d\uff0c\u5982\u679c\u5c06match\u8bbe\u7f6e\u4e3a**nginx**\uff0c\u90a3\u4e48ltsv.nginx\u4e5f\u4f1a\u88ab\u5339\u914d\u5230\uff0c\u5e76\u4e14ltsv\u65e0\u6cd5\u6267\u884c\u3002<br \/>\n\u89e3\u51b3\u65b9\u6cd5\u53ef\u4ee5\u662f\u5c06**nginx**\u79fb\u5230ltsv\u7684\u4e0b\u9762\uff0c\u6216\u8005\u5c06match\u8303\u56f4\u66f4\u52a0\u9650\u5b9a\uff1f\u4f46\u662f\u6211\u9009\u62e9\u4e86\u540e\u8005\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;match **nginx**&gt;\r\n  type copy\r\n  &lt;store&gt;\r\n    type parser\r\n    format ltsv\r\n    time_format %d\/%b\/%Y:%H:%M:%S %z\r\n    add_prefix ltsv\r\n    key_name message\r\n  &lt;\/store&gt;\r\n  &lt;store&gt;\r\n    type file\r\n    path \/tmp\/fluent.log\r\n  &lt;\/store&gt;\r\n&lt;\/match&gt;\r\n\r\n&lt;match ltsv**&gt;\r\n  type elasticsearch\r\n  host localhost\r\n  port 9200\r\n  index_name fluentd\r\n  type_name fluentd\r\n  logstash_format true\r\n  logstash_prefix test\r\n&lt;\/match&gt;\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fde\u63a5\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u5f88\u56f0\u96be\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a\u5f53\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5f88\u96be\u5224\u65ad\u662f\u54ea\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u51fa\u9519\u4e86\u3002 \u56e0\u6b64\uff0c\u5728\u8fde\u63a5td [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-41164","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5 - Blog - Silicon Cloud<\/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.silicloud.com\/zh\/blog\/\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u8fde\u63a5\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u5f88\u56f0\u96be\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a\u5f53\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5f88\u96be\u5224\u65ad\u662f\u54ea\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u51fa\u9519\u4e86\u3002 \u56e0\u6b64\uff0c\u5728\u8fde\u63a5td [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-17T09:37:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T02:52:14+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\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.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/\",\"name\":\"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-08-17T09:37:08+00:00\",\"dateModified\":\"2024-01-15T02:52:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5 - Blog - Silicon Cloud","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.silicloud.com\/zh\/blog\/\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\/","og_locale":"zh_CN","og_type":"article","og_title":"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5","og_description":"\u8fde\u63a5\u72ec\u7acb\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u5f88\u56f0\u96be\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a\u5f53\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5f88\u96be\u5224\u65ad\u662f\u54ea\u4e2a\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u51fa\u9519\u4e86\u3002 \u56e0\u6b64\uff0c\u5728\u8fde\u63a5td [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-08-17T09:37:08+00:00","article_modified_time":"2024-01-15T02:52:14+00:00","author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/","name":"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-08-17T09:37:08+00:00","dateModified":"2024-01-15T02:52:14+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u8fde\u63a5td-agent\uff08fluentd\uff09\u5230elasticsearch\u65f6\u7684\u8c03\u8bd5\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%bf%9e%e6%8e%a5td-agent%ef%bc%88fluentd%ef%bc%89%e5%88%b0elasticsearch%e6%97%b6%e7%9a%84%e8%b0%83%e8%af%95%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=41164"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41164\/revisions"}],"predecessor-version":[{"id":58793,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/41164\/revisions\/58793"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=41164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=41164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=41164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}