Class: MtrRec

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/codecs/mtrraw.rb

Overview

This codec presumes you’ve somehow sent in the equivalent of this bash one-liner: (echo “S MYTARGET” ; mtr –raw -c <samplecount> 8.8.8.8) | awk ‘$1“;”’ You can get that into logstash any way you want, e.g. netcat will work if you set up a tcp input: (echo “S MYTARGET” ; mtr –raw -c <samplecount> 8.8.8.8) | awk ‘$1“;”’ | nc <myserver> <myport>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ MtrRec



20
21
22
23
24
25
# File 'lib/logstash/codecs/mtrraw.rb', line 20

def initialize(line)
  parts = line.split(/\s+/,3)
  @type = parts[0]
  @id = parts[1]
  @data = parts[2]
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



19
20
21
# File 'lib/logstash/codecs/mtrraw.rb', line 19

def data
  @data
end

#idObject

Returns the value of attribute id.



19
20
21
# File 'lib/logstash/codecs/mtrraw.rb', line 19

def id
  @id
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/logstash/codecs/mtrraw.rb', line 19

def type
  @type
end