Sha256: 92e76455d598c8155b74fa2b85ddaad35f54288edf2b7e11d66ae7e2464a0618

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

# encoding: utf-8

require "logstash/api/commands/base"

module LogStash
  module Api
    module Commands
      class DefaultMetadata < Commands::Base
        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

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

        def version
          LOGSTASH_CORE_VERSION
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstash-core-7.2.1-java lib/logstash/api/commands/default_metadata.rb
logstash-core-7.2.0-java lib/logstash/api/commands/default_metadata.rb