Multiple types in statement now supported

This commit is contained in:
Karl Southern
2016-07-07 11:00:33 +01:00
parent 0f37792177
commit 43eb5d969d
5 changed files with 18 additions and 13 deletions

View File

@@ -246,14 +246,15 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
def add_statement_event_params(statement, event)
@statement[1..-1].each_with_index do |i, idx|
value = event.get(i)
value = if value.nil? and i.to_s =~ /%{/
event.sprintf(i)
else
value
end
if i.is_a? String
value = event.get(i)
if value.nil? and i =~ /%\{/
value = event.sprintf(i)
end
else
value = i
end
case value
when Time
# See LogStash::Timestamp, below, for the why behind strftime.