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
20
21
22
23
24
# 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"],
   :pipeline => {
     :workers => LogStash::SETTINGS.get("pipeline.workers"),
     :batch_size => LogStash::SETTINGS.get("pipeline.batch.size"),
     :batch_delay => LogStash::SETTINGS.get("pipeline.batch.delay"),
   }
   }
end

#hostObject



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

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

#http_addressObject



34
35
36
37
38
# File 'lib/logstash/api/commands/default_metadata.rb', line 34

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

#versionObject



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

def version
  LOGSTASH_CORE_VERSION
end