Skip to content

Commit

Permalink
Add syslog input test for priority bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jbussdieker committed Jan 27, 2014
1 parent 3fb7cfb commit f3533ac
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec/inputs/syslog.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# coding: utf-8
require "test_utils"
require "socket"

describe "inputs/syslog" do
extend LogStash::RSpec

describe "properly handles priority, severity and facilities" do
port = 5511
event_count = 10

config <<-CONFIG
input {
syslog {
type => "blah"
port => #{port}
}
}
CONFIG

input do |pipeline, queue|
Thread.new { pipeline.run }
sleep 0.1 while !pipeline.ready?

socket = Stud.try(5.times) { TCPSocket.new("127.0.0.1", port) }
event_count.times do |i|
socket.puts("<164>Oct 26 15:19:25 1.2.3.4 %ASA-4-106023: Deny udp src DRAC:10.1.2.3/43434 dst outside:192.168.0.1/53 by access-group \"acl_drac\" [0x0, 0x0]")
end
socket.close

events = event_count.times.collect { queue.pop }
event_count.times do |i|
insist { events[i]["priority"] } == 164
insist { events[i]["severity"] } == 4
insist { events[i]["facility"] } == 20
end
end
end
end

0 comments on commit f3533ac

Please sign in to comment.