{"id":2772,"date":"2015-12-21T17:35:45","date_gmt":"2015-12-21T17:35:45","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2772"},"modified":"2015-12-21T17:35:45","modified_gmt":"2015-12-21T17:35:45","slug":"logstash-fixing-unable-to-fetch-mapping-do-you-have-indices-matching-the-pattern","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/logstash-fixing-unable-to-fetch-mapping-do-you-have-indices-matching-the-pattern\/","title":{"rendered":"Logstash: fixing \u201cUnable to fetch mapping. Do you have indices matching the pattern\u201d"},"content":{"rendered":"<p>If you set up ELK (elastic search, logstash, kibana) using a guide, you may get the following error:<\/p>\n<pre>\n\u201cUnable to fetch mapping. Do you have indices matching the pattern\u201d\n<\/pre>\n<p>This indicates that Kibana can&#8217;t find log data in elastic search. When the logstash service starts correctly, it creates this database (one per day, apparently).<\/p>\n<p>Apparently if it encounters errors on some log file, it will just give up, rather than indexing the log files it can access.<\/p>\n<p>You can see this by doing this:<\/p>\n<pre lang=\"bash\">\ntail -n 50 \/var\/log\/logstash\/logstash.log\n<\/pre>\n<p>For instance, I had to fix several errors:<\/p>\n<pre>\n{:timestamp=>\"2015-12-21T15:07:01.931000+0000\", :message=>\"Error: No config files found: \/etc\/ash\/conf.d\/*\\nCan you make sure this path is a logstash config file?\"}\n{:timestamp=>\"2015-12-21T15:07:01.950000+0000\", :message=>\"You may be interested in the '--const' flag which you can\\nuse to validate logstash's configuration before you choose\\nto restartnning system.\"}\n<\/pre>\n<p>This meant I used a guide intended for an older version of logstash &#8211; the &#8220;host&#8221; entry changed to &#8220;hosts&#8221;:<\/p>\n<pre>\n{:timestamp=>\"2015-12-21T15:10:24.956000+0000\", :message=>\"Error: The setting `host` in pluginsticsearch` is obsolete and is no longer available. Please use the 'hosts' setting instead. Yo specify multiple entries separated by comma in 'host:port' format. If you have any questions  this, you are invited to visit https:\/\/discuss.elastic.co\/c\/logstash and ask.\"}\n{:timestamp=>\"2015-12-21T15:10:24.968000+0000\", :message=>\"You may be interested in the '--const' flag which you can\\nuse to validate logstash's configuration before you choose\\nto restartnning system.\"}\n<\/pre>\n<p>And this meant logstash couldn&#8217;t read all the files I gave it &#8211; the solution was to add the logstash user to the adm group:<\/p>\n<p>{:timestamp=>&#8221;2015-12-21T17:15:52.282000+0000&#8243;, :message=>&#8221;failed to open \/var\/log\/auth.log: Permission denied &#8211; \/var\/log\/auth.log&#8221;, :level=>:warn}<br \/>\n{:timestamp=>&#8221;2015-12-21T17:15:52.296000+0000&#8243;, :message=>&#8221;failed to open \/var\/log\/kern.log: Permission denied &#8211; \/var\/log\/kern.log&#8221;, :level=>:warn}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you set up ELK (elastic search, logstash, kibana) using a guide, you may get the following error: \u201cUnable to fetch mapping. Do you have indices matching the pattern\u201d This indicates that Kibana can&#8217;t find log data in elastic search. When the logstash service starts correctly, it creates this database (one per day, apparently). Apparently &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/logstash-fixing-unable-to-fetch-mapping-do-you-have-indices-matching-the-pattern\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Logstash: fixing \u201cUnable to fetch mapping. Do you have indices matching the pattern\u201d&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[347],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2772"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=2772"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2772\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}