Method: Fluent::Plugin::ElasticsearchInput#configure

Defined in:
lib/fluent/plugin/in_elasticsearch.rb

#configure(conf) ⇒ Object

Raises:

  • (Fluent::ConfigError)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/fluent/plugin/in_elasticsearch.rb', line 64

def configure(conf)
  super

  @timestamp_parser = create_time_parser
  @backend_options = backend_options

  raise Fluent::ConfigError, "`password` must be present if `user` is present" if @user && @password.nil?

  if @user && m = @user.match(/%{(?<user>.*)}/)
    @user = URI.encode_www_form_component(m["user"])
  end
  if @password && m = @password.match(/%{(?<password>.*)}/)
    @password = URI.encode_www_form_component(m["password"])
  end

  @transport_logger = nil
  if @with_transporter_log
    @transport_logger = log
    log_level = conf['@log_level'] || conf['log_level']
    log.warn "Consider to specify log_level with @log_level." unless log_level
  end
  @current_config = nil
  # Specify @sniffer_class before calling #client.
  @sniffer_class = nil
  begin
    @sniffer_class = Object.const_get(@sniffer_class_name) if @sniffer_class_name
  rescue Exception => ex
    raise Fluent::ConfigError, "Could not load sniffer class #{@sniffer_class_name}: #{ex}"
  end

  @options = {
    :index => @index_name,
    :scroll => @scroll,
    :size => @size
  }
  @base_query = @query
end