Module: LogStash::Outputs::ElasticSearch::Shield

Defined in:
lib/logstash/outputs/elasticsearch/shield.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_client_config(arg) ⇒ Object



12
# File 'lib/logstash/outputs/elasticsearch/shield.rb', line 12

def self.create_client_config(arg); {}; end

.included(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/logstash/outputs/elasticsearch/shield.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
  base.create_options
  base.branch_ssl_setup
  base.branch_auth_setup
end

Instance Method Details

#_setup_nothingObject



40
# File 'lib/logstash/outputs/elasticsearch/shield.rb', line 40

def _setup_nothing; {}; end

#_setup_transport_sslObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/logstash/outputs/elasticsearch/shield.rb', line 42

def _setup_transport_ssl

  settings = {}

  if @protocol == "node" && (@ssl || @user || @password) then
    @logger.warn "Shield is not supported on \"node\" protocol: switching to \"transport\".."
    @protocol = "transport"
  end

  require 'logstash-output-elasticsearch-shield_jars'

  if @ssl
    settings['shield.transport.ssl'] = @ssl
    settings['shield.ssl.keystore.path'] = @keystore if @keystore
    settings['shield.ssl.keystore.password'] = @keystore_password.value if @keystore_password
    settings['shield.transport.ssl.truststore.path'] = @truststore if @truststore
    settings['shield.transport.ssl.truststore.password'] = @truststore_password.value if @truststore_password
  end

  if @user && @password
    settings['request.headers.Authorization'] =
      'Basic ' + Base64.strict_encode64(@user + ':' + @password.value)
  end

  settings
end