Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Java stack trace's JAVAFILE to better match generated names #272

Merged
merged 3 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.2.0
- Fix: Java stack trace's JAVAFILE to better match generated names

## 4.1.2
- Fix some documentation issues

Expand Down
2 changes: 1 addition & 1 deletion logstash-patterns-core.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-patterns-core'
s.version = '4.1.2'
s.version = '4.2.0'
s.licenses = ['Apache License (2.0)']
s.summary = "Patterns to be used in logstash"
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"
Expand Down
2 changes: 1 addition & 1 deletion patterns/java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JAVACLASS (?:[a-zA-Z$_][a-zA-Z$_0-9]*\.)*[a-zA-Z$_][a-zA-Z$_0-9]*
#Space is an allowed character to match special cases like 'Native Method' or 'Unknown Source'
JAVAFILE (?:[A-Za-z0-9_. -]+)
JAVAFILE (?:[a-zA-Z$_0-9. -]+)
#Allow special <init>, <clinit> methods
JAVAMETHOD (?:(<(?:cl)?init>)|[a-zA-Z$_][a-zA-Z$_0-9]*)
#Line number is optional in special cases 'Native method' or 'Unknown source'
Expand Down
27 changes: 27 additions & 0 deletions spec/patterns/java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,30 @@
end
end
end

describe "JAVASTACKTRACEPART" do
let(:pattern) { 'JAVASTACKTRACEPART' }
let(:message) { ' at com.sample.stacktrace.StackTraceExample.aMethod(StackTraceExample.java:42)' }
it "matches" do
grok = grok_match(pattern, message, true)
expect(grok).to include({
"message"=>" at com.sample.stacktrace.StackTraceExample.aMethod(StackTraceExample.java:42)",
"method"=>"aMethod",
"class"=>"com.sample.stacktrace.StackTraceExample",
"file"=>"StackTraceExample.java",
"line"=>"42"
})
end

context 'generated file' do
let(:message) { ' at org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)' }
it "matches" do
grok = grok_match(pattern, message, true)
expect(grok).to include({
"method"=>"call",
"class"=>"org.jruby.RubyMethod$INVOKER$i$call",
"file"=>"RubyMethod$INVOKER$i$call.gen",
})
end
end
end