Sha256: 0c7ca46fa06a21bd4bcd63318515753af40fedca4160cefcc215453557f11f1b

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require "test_utils"

describe "receive graphite input", :if => RUBY_ENGINE == "jruby" do
  extend LogStash::RSpec

  # The logstash config goes here.
  # At this time, only filters are supported.
  config <<-CONFIG
    # input {
    #   tcp {
    #     port => 1234
    #     mode => server
    #     type => graphite
    #   }
    # }
    filter {
      grok {
        pattern => "%{DATA:name} %{NUMBER:value:float} %{POSINT:ts}"
        singles => true
      }
      date {
        match => ["ts", UNIX]
      }
      mutate {
        remove => ts
      }
    }
  CONFIG

  type "graphite"

  sample "foo.bar.baz 4025.34 1364606522" do
    insist { subject }.include?("name")
    insist { subject }.include?("value")

    insist { subject["name"] } == "foo.bar.baz"
    insist { subject["value"] } == 4025.34
    insist { subject["@timestamp"] } == Time.iso8601("2013-03-30T01:22:02.000Z")
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 spec/examples/graphite-input.rb