Class: Edge::Entry

Inherits:
Object
  • Object
show all
Includes:
Edge
Defined in:
lib/logstash/outputs/Edge/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Edge

#to_ns

Constructor Details

#initialize(event, message_field, include_fields) ⇒ Entry

Returns a new instance of Entry.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/logstash/outputs/Edge/entry.rb', line 8

def initialize(event,message_field,include_fields)
    @entry = {
        "ts" => to_ns(event.get("@timestamp")),
        "line" => event.get(message_field).to_s
    }
    event = event.clone()
    event.remove(message_field)
    event.remove("@timestamp")

    @labels = {}
    event.to_hash.each { |key,value|
        next if key.start_with?('@')
        next if value.is_a?(Hash)
        next if include_fields.length() > 0 and not include_fields.include?(key)
        @labels[key] = value.to_s
    }
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



7
8
9
# File 'lib/logstash/outputs/Edge/entry.rb', line 7

def entry
  @entry
end

#labelsObject (readonly)

Returns the value of attribute labels.



7
8
9
# File 'lib/logstash/outputs/Edge/entry.rb', line 7

def labels
  @labels
end