mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- add fail2ban log sample test
This commit is contained in:
parent
85be32b5ca
commit
c986fa41af
1 changed files with 28 additions and 0 deletions
28
spec/examples/fail2ban.rb
Normal file
28
spec/examples/fail2ban.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require "test_utils"
|
||||
|
||||
describe "fail2ban logs" do
|
||||
extend LogStash::RSpec
|
||||
|
||||
# The logstash config goes here.
|
||||
# At this time, only filters are supported.
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
grok {
|
||||
pattern => "^%{TIMESTAMP_ISO8601:timestamp} fail2ban\.actions: %{WORD:level} \\[%{WORD:program}\\] %{WORD:action} %{IP:ip}"
|
||||
singles => true
|
||||
}
|
||||
date {
|
||||
match => [ "timestamp", "yyyy-MM-dd HH:mm:ss,SSS" ]
|
||||
}
|
||||
mutate {
|
||||
remove => timestamp
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample "2013-06-28 15:10:59,891 fail2ban.actions: WARNING [ssh] Ban 95.78.163.5" do
|
||||
insist { subject["program"] } == "ssh"
|
||||
insist { subject["action"] } == "Ban"
|
||||
insist { subject["ip"] } == "95.78.163.5"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue