Skip to content

Instantly share code, notes, and snippets.

@davux
Created July 31, 2015 23:02
Show Gist options
  • Save davux/7d5ce9ad59a487d5d686 to your computer and use it in GitHub Desktop.
Save davux/7d5ce9ad59a487d5d686 to your computer and use it in GitHub Desktop.
Chef recipes to create a daily index pattern in ES for Kibana 4.1.1, and declare that index as the default one
http_request "create_daily_index_pattern" do
url 'http://localhost:9200/.kibana/index-pattern/%5Blogstash-%5DYYYY.MM.DD'
action :put
headers ({ "Content-Type" => "application/json" })
message ({ :title => "[logstash-]YYYY.MM.DD",
:timeFieldName => "@timestamp",
:intervalName => "days",
}.to_json)
end
#XXX: Don't hardcode 4.1.1 (Kibana version)
http_request "make_index_pattern_default" do
url 'http://localhost:9200/.kibana/config/4.1.1/_update'
action :post
headers ({ "Content-Type" => "application/json" })
message ({ :doc => { :defaultIndex => "[logstash-]YYYY.MM.DD" },
:doc_as_upsert => true
}.to_json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment