mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Merge pull request #1259 from colinsurprenant/issue-1258
fix and regression tests for github issue #1258
This commit is contained in:
commit
8eed4a9233
2 changed files with 37 additions and 1 deletions
|
@ -208,7 +208,7 @@ class LogStash::Filters::Multiline < LogStash::Filters::Base
|
|||
# multiline, send it.
|
||||
if pending
|
||||
pending.append(event)
|
||||
event.overwrite(pending.to_hash)
|
||||
event.overwrite(pending)
|
||||
@pending.delete(key)
|
||||
end
|
||||
end # if/else match
|
||||
|
|
|
@ -119,4 +119,40 @@ describe LogStash::Filters::Multiline do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "regression test for GH issue #1258" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
multiline {
|
||||
pattern => "^\s"
|
||||
what => "next"
|
||||
add_tag => ["multi"]
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample [ " match", "nomatch" ] do
|
||||
expect(subject).to be_a(LogStash::Event)
|
||||
insist { subject["message"] } == " match\nnomatch"
|
||||
end
|
||||
end
|
||||
|
||||
describe "multiple match/nomatch" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
multiline {
|
||||
pattern => "^\s"
|
||||
what => "next"
|
||||
add_tag => ["multi"]
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample [" match1", "nomatch1", " match2", "nomatch2"] do
|
||||
expect(subject).to be_a(Array)
|
||||
insist { subject.size } == 2
|
||||
insist { subject[0]["message"] } == " match1\nnomatch1"
|
||||
insist { subject[1]["message"] } == " match2\nnomatch2"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue