Sha256: 19612950ff19d92be91b10e48cce12bb8559840f0ef387acdfc3eb9cb735bee9
Contents?: true
Size: 989 Bytes
Versions: 1
Compression:
Stored size: 989 Bytes
Contents
require 'socket' class Logasm module Utils HOST = ::Socket.gethostname # Build logstash json compatible event # # @param [Hash] metadata # @param [#to_s] level # @param [String] service_name # # @return [Hash] def self.build_event(metadata, level, service_name) overwritable_params .merge(metadata) .merge( application: application_name(service_name), level: level.to_s.downcase ) end # Return application name # # Returns lower snake case application name. This allows the # application value to be used in the elasticsearch index name. # # @param [String] service_name # # @return [String] def self.application_name(service_name) Inflecto.underscore(service_name) end def self.overwritable_params { :@timestamp => Time.now.utc.iso8601, host: HOST } end private_class_method :overwritable_params end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logasm-0.2.4 | lib/logasm/utils.rb |