Skip to content

Commit 678ea3d

Browse files
committed
Merge branch 'master' into ecs-wip
* master: Fix: NAGIOS TIMEPERIOD unknown (from/to) field matching (#275) Fix: match Information/INFORMATION in LOGLEVEL (#274) Fix: Java stack trace's JAVAFILE to better match generated names (#272)
2 parents 4e291a0 + cab2b80 commit 678ea3d

File tree

8 files changed

+54
-5
lines changed

8 files changed

+54
-5
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.2.0
2+
- Fix: Java stack trace's JAVAFILE to better match generated names
3+
- Fix: match Information/INFORMATION in LOGLEVEL [#274](https://github.com/logstash-plugins/logstash-patterns-core/pull/274)
4+
- Fix: NAGIOS TIMEPERIOD unknown (from/to) field matching [#275](https://github.com/logstash-plugins/logstash-patterns-core/pull/275)
5+
16
## 4.1.2
27
- Fix some documentation issues
38

logstash-patterns-core.gemspec

+1-1
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.1.2'
4+
s.version = '4.2.0'
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/grok-patterns

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ QS %{QUOTEDSTRING}
9292
SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
9393

9494
# Log Levels
95-
LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)
95+
LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo?(?:rmation)?|INFO?(?:RMATION)?|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)

patterns/ecs-v1/java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
JAVACLASS (?:[a-zA-Z$_][a-zA-Z$_0-9]*\.)*[a-zA-Z$_][a-zA-Z$_0-9]*
22
#Space is an allowed character to match special cases like 'Native Method' or 'Unknown Source'
3-
JAVAFILE (?:[A-Za-z0-9_. -]+)
3+
JAVAFILE (?:[a-zA-Z$_0-9. -]+)
44
#Allow special <init>, <clinit> methods
55
JAVAMETHOD (?:(<(?:cl)?init>)|[a-zA-Z$_][a-zA-Z$_0-9]*)
66
#Line number is optional in special cases 'Native method' or 'Unknown source'

patterns/ecs-v1/nagios

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ NAGIOS_PASSIVE_HOST_CHECK %{NAGIOS_TYPE_PASSIVE_HOST_CHECK:nagios_type}: %{DATA:
8989
NAGIOS_SERVICE_EVENT_HANDLER %{NAGIOS_TYPE_SERVICE_EVENT_HANDLER:nagios_type}: %{DATA:nagios_hostname};%{DATA:nagios_service};%{DATA:nagios_state};%{DATA:nagios_statelevel};%{DATA:nagios_event_handler_name}
9090
NAGIOS_HOST_EVENT_HANDLER %{NAGIOS_TYPE_HOST_EVENT_HANDLER:nagios_type}: %{DATA:nagios_hostname};%{DATA:nagios_state};%{DATA:nagios_statelevel};%{DATA:nagios_event_handler_name}
9191

92-
NAGIOS_TIMEPERIOD_TRANSITION %{NAGIOS_TYPE_TIMEPERIOD_TRANSITION:nagios_type}: %{DATA:nagios_service};%{DATA:nagios_unknown1};%{DATA:nagios_unknown2}
92+
NAGIOS_TIMEPERIOD_TRANSITION %{NAGIOS_TYPE_TIMEPERIOD_TRANSITION:nagios_type}: %{DATA:nagios_service};%{NUMBER:nagios_unknown1};%{NUMBER:nagios_unknown2}
9393

9494
####################
9595
#### External checks

spec/patterns/core_spec.rb

+13
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@
6363
end
6464
end
6565

66+
describe 'LOGLEVEL' do
67+
it 'matches info label' do
68+
expect(grok_match(subject, 'INFO')).to pass
69+
expect(grok_match(subject, 'info')).to pass
70+
end
71+
72+
it 'matches information label' do
73+
expect(grok_match(subject, 'information')).to pass
74+
expect(grok_match(subject, 'Information')).to pass
75+
expect(grok_match(subject, 'INFORMATION')).to pass
76+
end
77+
end
78+
6679
describe "IPORHOST" do
6780

6881
let(:pattern) { "IPORHOST" }

spec/patterns/java_spec.rb

+27
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,30 @@
1616
end
1717
end
1818
end
19+
20+
describe "JAVASTACKTRACEPART" do
21+
let(:pattern) { 'JAVASTACKTRACEPART' }
22+
let(:message) { ' at com.sample.stacktrace.StackTraceExample.aMethod(StackTraceExample.java:42)' }
23+
it "matches" do
24+
grok = grok_match(pattern, message, true)
25+
expect(grok).to include({
26+
"message"=>" at com.sample.stacktrace.StackTraceExample.aMethod(StackTraceExample.java:42)",
27+
"method"=>"aMethod",
28+
"class"=>"com.sample.stacktrace.StackTraceExample",
29+
"file"=>"StackTraceExample.java",
30+
"line"=>"42"
31+
})
32+
end
33+
34+
context 'generated file' do
35+
let(:message) { ' at org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)' }
36+
it "matches" do
37+
grok = grok_match(pattern, message, true)
38+
expect(grok).to include({
39+
"method"=>"call",
40+
"class"=>"org.jruby.RubyMethod$INVOKER$i$call",
41+
"file"=>"RubyMethod$INVOKER$i$call.gen",
42+
})
43+
end
44+
end
45+
end

spec/patterns/nagios_spec.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
describe "NAGIOSLOGLINE - TIMEPERIOD TRANSITION" do
8484

85-
let(:value) { "[1427925600] TIMEPERIOD TRANSITION: 24X7;1;1" }
85+
let(:value) { "[1427925600] TIMEPERIOD TRANSITION: 24X7;-1;1" }
8686
let(:grok) { grok_match(subject, value) }
8787

8888
it "a pattern pass the grok expression" do
@@ -105,6 +105,10 @@
105105
expect(grok).to include("nagios_service" => "24X7")
106106
end
107107

108+
it "generates the period from/to fields" do
109+
expect(grok).to include("nagios_unknown1" => "-1", "nagios_unknown2" => "1")
110+
end
111+
108112
# Regression test for but fixed in Nagios patterns #30
109113
it "doesn't end in a semi-colon" do
110114
expect(grok['message']).to_not end_with(";")

0 commit comments

Comments
 (0)