Class: LogStash::Outputs::ElasticsearchHTTP

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/logstash/outputs/elasticsearch_http.rb

Overview

This plugin is deprecated in favor of using elasticsearch output and the http protocol Please update your current configuration!

.Example

source,ruby

elasticsearch

protocol => 'http'
host => '127.0.0.1'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ElasticsearchHTTP

Returns a new instance of ElasticsearchHTTP.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/logstash/outputs/elasticsearch_http.rb', line 99

def initialize(options = {})
  super(options)

  @logger = Cabin::Channel.get(LogStash)
  warning_message = []

  warning_message << "The elasticsearch_http output is replaced by the elasticsearch output and will be removed in a future version of Logstash"

  if options.delete("replication") == "async"
    warning_message << "Ignoring the async replication option, this option is not recommended and not supported by this plugin"
  end

  # transform configuration
  options["host"] = [options['host']]
  options["protocol"] = "http"

  
  # Generate a migration configuration for the new elasticsearch output
  # using the current settings as the base.
  warning_message << "The following configuration example is based on the options you specified and should work:"
  warning_message << "elasticsearch {"

  @config.each do |option, value|
    if display_option?(option, value)
      warning_message << "#{option} => #{format_value(value)}"
    end
  end

  warning_message << "}\n"

  @logger.warn(warning_message.join("\n"))
  @elasticsearch_output = LogStash::Outputs::ElasticSearch.new(options)
end