Skip to content

Commit

Permalink
- warn on use of deprecated regexp configs (LOGSTASH-756)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Feb 5, 2013
1 parent a103dc4 commit 39deded
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/logstash/filters/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def register
#TODO(electrical): At some point this can be removed
@config.each do |field, dest|
next if (RESERVED + ["fields", "separator", "source", "columns", "target"]).member?(field)
@logger.warn("You used a deprecated setting '#{field} => #{dest}'. You should use 'source => "%{field}"' and 'target => %{dest}'")
@csv[field] = dest
end

Expand Down
4 changes: 2 additions & 2 deletions lib/logstash/filters/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def register
locale = parseLocale(@config["locale"][0]) if @config["locale"] != nil and @config["locale"][0] != nil
missing = []
@config.each do |field, value|
next if (RESERVED + ["locale"]).include?(field)
next if (RESERVED + ["match"]).include?(field)
next if (RESERVED + ["locale", "match"]).include?(field)

@logger.warn("You used a deprecated setting '#{field} => #{value}'. You should use 'match => [ \"#{field}\", \"#{value}\" ]'")
# values here are an array of format strings for the given field.
setupMatcher(field, locale, missing, value) # value.each
end # @config.each
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/filters/grok.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def register
patterns.each do |pattern|
@logger.debug? and @logger.debug("regexp: #{@type}/#{field}", :pattern => pattern)
@patterns[field].compile(pattern)
@logger.warn("You used a deprecated setting '#{field} => #{pattern}'. You should use 'match => [ \"#{field}\", \"#{pattern}\" ]'")
end
end # @config.each
end # def register
Expand Down
3 changes: 2 additions & 1 deletion lib/logstash/filters/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LogStash::Filters::Json < LogStash::Filters::Base
# JSON in the value of the source field will be expanded into a
# datastructure in the "dest" field. Note: if the "dest" field
# already exists, it will be overridden.
config /[A-Za-z0-9_@-]+/, :validate => :string
config /[A-Za-z0-9_@-]+/, :validate => :string, :deprecated => true

# Config for json is:
#
Expand Down Expand Up @@ -63,6 +63,7 @@ def register

@config.each do |field, dest|
next if (RESERVED + ["source", "target"]).member?(field)
@logger.warn("You used a deprecated setting '#{field} => #{dest}'. You should use 'source => "%{field}"' and 'target => %{dest}'")
@json[field] = dest
end

Expand Down
1 change: 1 addition & 0 deletions lib/logstash/filters/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def register
#TODO(electrical): Will be removed when its fully deprecated
@config.each do |field, dest|
next if (RESERVED + ["xpath", "store_xml", "source", "target"]).member?(field)
@logger.warn("You used a deprecated setting '#{field} => #{dest}'. You should use 'source => "%{field}"' and 'target => %{dest}'")
@xml[field] = dest
end

Expand Down

0 comments on commit 39deded

Please sign in to comment.