Sha256: bf75f1b16fa84eeb96362c5c3bf3ed37b821e686805eacd84727f02f6ea79f6b
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# encoding: utf-8 require "spec_helper" require "logstash/filters/useragent" describe LogStash::Filters::UserAgent do describe "defaults" do config <<-CONFIG filter { useragent { source => "message" target => "ua" } } CONFIG sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do insist { subject }.include?("ua") insist { subject["ua"]["name"] } == "Chrome" insist { subject["ua"]["os"] } == "Linux" insist { subject["ua"]["major"] } == "26" insist { subject["ua"]["minor"] } == "0" end end describe "Without target field" do config <<-CONFIG filter { useragent { source => "message" } } CONFIG sample "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" do insist { subject["name"] } == "Chrome" insist { subject["os"] } == "Linux" insist { subject["major"] } == "26" insist { subject["minor"] } == "0" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-filter-useragent-0.1.0 | spec/filters/useragent_spec.rb |