mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- Add test coverage for grok against numeric-typed field values.
(that is, a literal 1 or 1.0 instead of "1" or "1.0" string)
This commit is contained in:
parent
cdb973c6b9
commit
d4c5a27e04
1 changed files with 32 additions and 0 deletions
|
@ -203,4 +203,36 @@ describe LogStash::Filters::Grok do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "grok on integer types" do
|
||||
config <<-'CONFIG'
|
||||
filter {
|
||||
grok {
|
||||
match => [ "status", "^403$" ]
|
||||
add_tag => "four_oh_three"
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample({ "@fields" => { "status" => 403 } }) do
|
||||
reject { subject.tags }.include?("_grokparsefailure")
|
||||
insist { subject.tags }.include?("four_oh_three")
|
||||
end
|
||||
end
|
||||
|
||||
describe "grok on float types" do
|
||||
config <<-'CONFIG'
|
||||
filter {
|
||||
grok {
|
||||
match => [ "version", "^1.0$" ]
|
||||
add_tag => "one_point_oh"
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample({ "@fields" => { "version" => 1.0 } }) do
|
||||
reject { subject.tags }.include?("_grokparsefailure")
|
||||
insist { subject.tags }.include?("one_point_oh")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue