forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add syslog input test for priority bug
- Loading branch information
1 parent
3fb7cfb
commit f3533ac
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|