Skip to content

Commit 7f94275

Browse files
authored
Fix: incorrect syslog (priority) field name (#303)
+ Test: handle compatibility with JRuby 9.2.15.0 + Fix: missed `ciscotag` ECS-ification for CISCO_TAGGED_SYSLOG
1 parent dc33cb5 commit 7f94275

File tree

7 files changed

+48
-5
lines changed

7 files changed

+48
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.3.1
2+
3+
- Fix: incorrect syslog (priority) field name [#303](https://github.com/logstash-plugins/logstash-patterns-core/pull/303)
4+
- Fix: missed `ciscotag` field ECS-ification (`cisco.asa.tag`) for the `CISCO_TAGGED_SYSLOG` pattern
5+
16
## 4.3.0
27

38
With **4.3.0** we're introducing a new set of pattern definitions compliant with Elastic Common Schema (ECS), on numerous

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.0'
4+
s.version = '4.3.1'
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/firewalls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ NETSCREENSESSIONLOG %{SYSLOGTIMESTAMP:timestamp} %{IPORHOST:[observer][hostname]
44
# :long - %{INT:[destination][bytes]:int}
55

66
#== Cisco ASA ==
7-
CISCO_TAGGED_SYSLOG ^<%{POSINT:[log][syslog][facility][code]:int}>%{CISCOTIMESTAMP:timestamp}( %{SYSLOGHOST:[host][hostname]})? ?: %%{CISCOTAG:ciscotag}:
7+
CISCO_TAGGED_SYSLOG ^<%{POSINT:[log][syslog][priority]:int}>%{CISCOTIMESTAMP:timestamp}( %{SYSLOGHOST:[host][hostname]})? ?: %%{CISCOTAG:[cisco][asa][tag]}:
88
CISCOTIMESTAMP %{MONTH} +%{MONTHDAY}(?: %{YEAR})? %{TIME}
99
CISCOTAG [A-Z0-9]+-%{INT}-(?:[A-Z0-9_]+)
1010
# Common Particles

patterns/ecs-v1/linux-syslog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CRONLOG %{SYSLOGBASE} \(%{USER:[user][name]}\) %{CRON_ACTION:[system][cron][acti
99
SYSLOGLINE %{SYSLOGBASE2} %{GREEDYDATA:message}
1010

1111
# IETF 5424 syslog(8) format (see http://www.rfc-editor.org/info/rfc5424)
12-
SYSLOG5424PRI <%{NONNEGINT:[log][syslog][facility][code]:int}>
12+
SYSLOG5424PRI <%{NONNEGINT:[log][syslog][priority]:int}>
1313
SYSLOG5424SD \[%{DATA}\]+
1414
SYSLOG5424BASE %{SYSLOG5424PRI}%{NONNEGINT:[system][syslog][version]} +(?:-|%{TIMESTAMP_ISO8601:timestamp}) +(?:-|%{IPORHOST:[host][hostname]}) +(?:-|%{SYSLOG5424PRINTASCII:[process][name]}) +(?:-|%{POSINT:[process][pid]:int}) +(?:-|%{SYSLOG5424PRINTASCII:[event][code]}) +(?:-|%{SYSLOG5424SD:[system][syslog][structured_data]})?
1515

spec/patterns/firewalls_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,44 @@
595595

596596
end
597597

598+
describe_pattern "CISCO_TAGGED_SYSLOG", ['legacy', 'ecs-v1'] do
599+
600+
let(:message) { "<191>Jan 24 11:28:30.407: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down" }
601+
602+
it 'matches' do
603+
expect(subject).to include("timestamp"=>'Jan 24 11:28:30.407')
604+
if ecs_compatibility?
605+
expect(subject).to include('log' => {'syslog' => {'priority' => 191}})
606+
expect(subject).to include('cisco' => {'asa' => {'tag' => 'LINEPROTO-5-UPDOWN'}})
607+
else
608+
expect(subject).to include("syslog_pri"=>'191')
609+
expect(subject).to include("ciscotag"=>'LINEPROTO-5-UPDOWN')
610+
end
611+
end
612+
613+
context 'with host' do
614+
615+
let(:message) do
616+
'<191>Aug 1 14:01:20 abc-asa1: %ASA-6-302013: Built outbound TCP connection 906569140 for out-v1101:10.125.126.86/2010 (10.125.126.86/2010) to ent-v1124:100.100.100.111/51444 (10.125.1.11/37785)'
617+
end
618+
619+
it 'matches' do
620+
expect(subject).to include("timestamp"=>'Aug 1 14:01:20')
621+
if ecs_compatibility?
622+
expect(subject).to include('log' => {'syslog' => {'priority' => 191}})
623+
expect(subject).to include('host' => {'hostname' => 'abc-asa1'})
624+
expect(subject).to include('cisco' => {'asa' => {'tag' => 'ASA-6-302013'}})
625+
else
626+
expect(subject).to include("syslog_pri"=>'191')
627+
expect(subject).to include("sysloghost"=>'abc-asa1')
628+
expect(subject).to include("ciscotag"=>'ASA-6-302013')
629+
end
630+
end
631+
632+
end
633+
634+
end
635+
598636

599637
describe_pattern 'SFW2', ['legacy', 'ecs-v1'] do
600638

spec/patterns/netscreen_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
context "(with session id)" do
9999

100100
let(:message) do
101-
super + ' session_id=0 reason=Traffic Denied'
101+
super() + ' session_id=0 reason=Traffic Denied'
102102
end
103103

104104
it 'matches (in ECS mode)' do

spec/patterns/syslog_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
message = "<174>1 2016-11-14T09:49:23+01:00 10.23.16.6 named 2255 - - info: client 10.23.56.93#63295 (i1.tmg.com): query: i1.tmg.com IN A + (10.23.4.13)"
9696
match = grok_match pattern, message
9797
if ecs_compatibility?
98-
expect(match).to include("log" => { "syslog" => { "facility" => { "code" => 174 }}})
98+
expect(match).to include("log" => { "syslog" => { "priority" => 174 }})
9999
expect(match).to include("host" => { "hostname" => "10.23.16.6"})
100100
expect(match).to include("process" => { "name" => "named", "pid" => 2255 })
101101
expect(match).to include("system" => { "syslog" => { "version" => "1" }})

0 commit comments

Comments
 (0)