Sha256: fc03821dd6eaa0fd9dce5d586e0451031e6e5ef9a9dc3452399b1b2b53ef8006
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
module Fluent::ElasticsearchIndexTemplate def get_template(template_file) if !File.exists?(template_file) raise "If you specify a template_name you must specify a valid template file (checked '#{template_file}')!" end file_contents = IO.read(template_file).gsub(/\n/,'') JSON.parse(file_contents) end def template_exists?(name) client.indices.get_template(:name => name) return true rescue Elasticsearch::Transport::Transport::Errors::NotFound return false end def template_put(name, template) client.indices.put_template(:name => name, :body => template) end def template_install(name, template_file) if !template_exists?(name) template_put(name, get_template(template_file)) log.info("Template configured, but no template installed. Installed '#{name}' from #{template_file}.") else log.info("Template configured and already installed.") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-elasticsearch-1.7.0 | lib/fluent/plugin/elasticsearch_index_template.rb |