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
# 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}
end

#hostObject



14
15
16
# File 'lib/logstash/api/commands/default_metadata.rb', line 14

def host
  Socket.gethostname
end

#http_addressObject



22
23
24
25
26
# File 'lib/logstash/api/commands/default_metadata.rb', line 22

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

#versionObject



18
19
20
# File 'lib/logstash/api/commands/default_metadata.rb', line 18

def version
  LOGSTASH_CORE_VERSION
end