@@ -44,6 +44,12 @@ class LogStash::Outputs::InfluxDB < LogStash::Outputs::Base
4444 # Both keys and values support sprintf formatting
4545 config :data_points , :validate => :hash , :default => { } , :required => true
4646
47+ # Do not use data_points. Use keys / values found in event instead.
48+ config :use_data_points , :validate => :boolean , :default => true
49+
50+ # Ignore some data_points if they are setted
51+ config :ignore_data_points , :validate => :array , :default => [ ]
52+
4753 # Allow the override of the `time` column in the event?
4854 #
4955 # By default any column with a name of `time` will be ignored and the time will
@@ -126,12 +132,21 @@ def receive(event)
126132 # ]
127133 event_hash = { }
128134 event_hash [ 'name' ] = event . sprintf ( @series )
129- sprintf_points = Hash [ @data_points . map { |k , v | [ event . sprintf ( k ) , event . sprintf ( v ) ] } ]
135+ if use_data_points
136+ sprintf_points = Hash [ @data_points . map { |k , v | [ event . sprintf ( k ) , event . sprintf ( v ) ] } ]
137+ else
138+ sprintf_points = event . to_hash
139+ end
130140 if sprintf_points . has_key? ( 'time' )
131141 @logger . error ( "Cannot override value of time without 'allow_override_time'. Using event timestamp" ) unless @allow_override_time
132142 else
133143 sprintf_points [ 'time' ] = to_epoch ( event . timestamp )
134144 end
145+ @ignore_data_points . each do |field |
146+ if sprintf_points . has_key? ( field )
147+ sprintf_points . delete ( field )
148+ end
149+ end
135150 @coerce_values . each do |column , value_type |
136151 if sprintf_points . has_key? ( column )
137152 begin
0 commit comments