Class: LogStash::Outputs::ElasticSearch::TemplateManager

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/elasticsearch/template_manager.rb

Class Method Summary collapse

Class Method Details

.install_template(plugin) ⇒ Object

To be mixed into the elasticsearch plugin base



4
5
6
7
8
9
10
11
12
# File 'lib/logstash/outputs/elasticsearch/template_manager.rb', line 4

def self.install_template(plugin)
  return unless plugin.manage_template
  plugin.logger.info("Using mapping template from", :path => plugin.template)
  template = get_template(plugin.template, get_es_major_version(plugin.client))
  plugin.logger.info("Attempting to install template", :manage_template => template)
  install(plugin.client, plugin.template_name, template, plugin.template_overwrite)
rescue => e
  plugin.logger.error("Failed to install template.", :message => e.message, :class => e.class.name, :backtrace => e.backtrace)
end