mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
commit
289a9318f8
2 changed files with 16 additions and 2 deletions
|
@ -238,8 +238,7 @@ class LogStash::Filters::Date < LogStash::Filters::Base
|
|||
@logger.debug? && @logger.debug("Date parsing done", :value => value, :timestamp => event.timestamp)
|
||||
rescue StandardError, JavaException => e
|
||||
@logger.warn("Failed parsing date from field", :field => field,
|
||||
:value => value, :format => parserconfig[:format],
|
||||
:exception => e)
|
||||
:value => value, :exception => e)
|
||||
# Raising here will bubble all the way up and cause an exit.
|
||||
# TODO(sissel): Maybe we shouldn't raise?
|
||||
# TODO(sissel): What do we do on a failure? Tag it like grok does?
|
||||
|
|
|
@ -227,4 +227,19 @@ describe LogStash::Filters::Date do
|
|||
insist { subject["@timestamp"] } == "2013-01-01T00:00:00.000Z"
|
||||
end
|
||||
end
|
||||
|
||||
describe "failing to parse should not throw an exception" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
date {
|
||||
match => [ "thedate", "yyyy/MM/dd" ]
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample({ "@fields" => { "thedate" => "2013/Apr/21" } }) do
|
||||
insist { subject["@timestamp"] } != "2013-04-21T00:00:00.000Z"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue