Merge pull request #452 from semiosis/LOGSTASH-1033

LOGSTASH-1033
This commit is contained in:
Jordan Sissel 2013-04-21 22:20:59 -07:00
commit 289a9318f8
2 changed files with 16 additions and 2 deletions

View file

@ -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?

View file

@ -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