Skip to content

Commit cd84000

Browse files
authored
Fix: typo in BIN9_QUERYLOG pattern (in ECS mode) (#307)
1 parent a01f322 commit cd84000

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.3.2
2+
3+
- Fix: typo in BIN9_QUERYLOG pattern (in ECS mode) [#307](https://github.com/logstash-plugins/logstash-patterns-core/pull/307)
4+
15
## 4.3.1
26

37
- Fix: incorrect syslog (priority) field name [#303](https://github.com/logstash-plugins/logstash-patterns-core/pull/303)

logstash-patterns-core.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-patterns-core'
4-
s.version = '4.3.1'
4+
s.version = '4.3.2'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Patterns to be used in logstash"
77
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

patterns/ecs-v1/bind

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ BIND9_CATEGORY (?:queries)
88
BIND9_QUERYLOGBASE client(:? @0x(?:[0-9A-Fa-f]+))? %{IP:[client][ip]}#%{POSINT:[client][port]:int} \(%{GREEDYDATA:[bind][log][question][name]}\): query: %{GREEDYDATA:[dns][question][name]} (?<[dns][question][class]>IN) %{BIND9_DNSTYPE:[dns][question][type]}(:? %{DATA:[bind][log][question][flags]})? \(%{IP:[server][ip]}\)
99

1010
# for query-logging category and severity are always fixed as "queries: info: "
11-
BIND9_QUERYLOG %{BIND9_TIMESTAMP:timestamp} %{BIND9_CATEGORY:[bing][log][category]}: %{LOGLEVEL:[log][level]}: %{BIND9_QUERYLOGBASE}
11+
BIND9_QUERYLOG %{BIND9_TIMESTAMP:timestamp} %{BIND9_CATEGORY:[bind][log][category]}: %{LOGLEVEL:[log][level]}: %{BIND9_QUERYLOGBASE}
1212

1313
BIND9 %{BIND9_QUERYLOG}

spec/patterns/bind_spec.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
should include("log" => hash_including("level" => "info"))
1515
should include("client" => { "ip" => "172.26.0.1", "port" => 12345 })
1616
should include("dns" => { "question" => { "name" => "test.example.com", "type" => 'A', "class" => 'IN' }})
17-
should include("bind" => { "log" => { "question" => hash_including("flags" => '+E(0)K')}})
17+
should include("bind" => { "log" => hash_including("question" => hash_including("flags" => '+E(0)K'))})
1818
should include("server" => { "ip" => "172.26.0.3" })
1919
# NOTE: duplicate but still captured since we've been doing that before as well :
20-
should include("bind" => { "log" => { "question" => hash_including("name" => 'test.example.com')}})
20+
should include("bind" => { "log" => hash_including("question" => hash_including("name" => 'test.example.com'))})
2121
else
2222
should include("loglevel" => "info")
2323
should include("clientip" => "172.26.0.1")
@@ -48,7 +48,7 @@
4848
should include("log" => hash_including("level" => "info"))
4949
should include("client" => { "ip" => "192.168.10.48", "port" => 60061 })
5050
should include("dns" => { "question" => { "name" => "91.2.10.170.in-addr.internal", "type" => 'PTR', "class" => 'IN' }})
51-
should include("bind" => { "log" => { "question" => hash_including("flags" => '+')}})
51+
should include("bind" => { "log" => hash_including("question" => hash_including("flags" => '+')) })
5252
should include("server" => { "ip" => "192.168.2.2" })
5353
else
5454
should include("loglevel" => "info")
@@ -72,7 +72,21 @@
7272
it 'matches' do
7373
should include("client" => { "ip" => "127.0.0.1", "port" => 42520 })
7474
should include("dns" => { "question" => { "name" => "ci.elastic.co", "type" => 'A', "class" => 'IN' }})
75-
should include("bind" => { "log" => { "question" => hash_including("flags" => '+E(0)K') }})
75+
should include("bind" => { "log" => hash_including("question" => hash_including("flags" => '+E(0)K') )})
7676
should include("server" => { "ip" => "35.193.103.164" })
7777
end
7878
end
79+
80+
describe_pattern "BIND9_QUERYLOG", ['ecs-v1'] do
81+
let(:message) do
82+
'01-May-2019 00:27:48.084 queries: info: client @0x7f82bc11d4e0 192.168.1.111#53995 (google.com): query: google.com IN A +E(0) (10.80.1.88)'
83+
end
84+
85+
it 'matches' do
86+
should include("client" => { "ip" => "192.168.1.111", "port" => 53995 })
87+
should include("dns" => { "question" => { "name" => "google.com", "type" => 'A', "class" => 'IN' }})
88+
should include("bind" => { "log" => hash_including("question" => { "flags" => '+E(0)', "name" => 'google.com' })})
89+
should include("server" => { "ip" => "10.80.1.88" })
90+
should include("log" => { "level" => "info" })
91+
end
92+
end

0 commit comments

Comments
 (0)