Class: LogStash::Api::Commands::DefaultMetadata

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/api/commands/default_metadata.rb

Instance Attribute Summary

Attributes inherited from Base

#service

Instance Method Summary collapse

Methods inherited from Base

#extract_metrics, #initialize, #started_at, #uptime

Constructor Details

This class inherits a constructor from LogStash::Api::Commands::Base

Instance Method Details

#allObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/logstash/api/commands/default_metadata.rb', line 9

def all
  {:host => host,
   :version => version,
   :http_address => http_address,
   :id => service.agent.id,
   :name => service.agent.name,
   :ephemeral_id => service.agent.ephemeral_id,
   :status => "green",  # This is hard-coded to mirror x-pack behavior
   :snapshot => ::BUILD_INFO["build_snapshot"],
   }
end

#hostObject



21
22
23
# File 'lib/logstash/api/commands/default_metadata.rb', line 21

def host
  @@host ||= Socket.gethostname
end

#http_addressObject



29
30
31
32
33
# File 'lib/logstash/api/commands/default_metadata.rb', line 29

def http_address
  @http_address ||= service.get_shallow(:http_address).value
rescue ::LogStash::Instrument::MetricStore::MetricNotFound, NoMethodError => e
  nil
end

#versionObject



25
26
27
# File 'lib/logstash/api/commands/default_metadata.rb', line 25

def version
  LOGSTASH_CORE_VERSION
end