Skip to content

Commit 7455352

Browse files
author
ryan-dyer-sp
committed
bad logic when dealing with null values
1 parent 7e0a6ba commit 7455352

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

fluent-plugin-elasticsearch-timestamp-check.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |spec|
22
spec.name = "fluent-plugin-elasticsearch-timestamp-check"
3-
spec.version = "0.2.0"
3+
spec.version = "0.2.1"
44
spec.authors = ["Richard Li"]
55
spec.email = ["[email protected]"]
66
spec.description = %q{fluent filter plugin to ensure @timestamp is in proper format}

lib/fluent/plugin/filter_elasticsearch_timestamp_check.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ def shutdown
1919

2020
def filter(tag, time, record)
2121
timestamps = [ record['@timestamp'], record['timestamp'], record['time'] ]
22+
valid = false
2223
timestamps.each do |timestamp|
2324
begin
24-
DateTime.parse(timestamp)
25-
valid = timestamp
26-
break
25+
if timestamp then
26+
DateTime.parse(timestamp)
27+
valid = timestamp
28+
break
29+
end
2730
rescue ArgumentError
2831
next
29-
else
30-
valid = false
3132
end
3233
end
3334

0 commit comments

Comments
 (0)