diff --git a/lib/logstash/filters/anonymize.rb b/lib/logstash/filters/anonymize.rb index 6393f6cf8..08be234b7 100644 --- a/lib/logstash/filters/anonymize.rb +++ b/lib/logstash/filters/anonymize.rb @@ -15,7 +15,7 @@ class LogStash::Filters::Anonymize < LogStash::Filters::Base config :key, :validate => :string, :required => true # digest/hash type - config :algorithm, :validate => ['SHA', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512', 'MD4', 'MD5', "MURMUR3", "IPV4_NETWORK"], :required => true, :default => 'SHA1' + config :algorithm, :validate => ['SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512', 'MD4', 'MD5', "MURMUR3", "IPV4_NETWORK"], :required => true, :default => 'SHA1' public def register @@ -63,8 +63,8 @@ class LogStash::Filters::Anonymize < LogStash::Filters::Base def algorithm case @algorithm - when 'SHA' - return OpenSSL::Digest::SHA.new + #when 'SHA' + #return OpenSSL::Digest::SHA.new when 'SHA1' return OpenSSL::Digest::SHA1.new when 'SHA224' diff --git a/spec/filters/anonymize.rb b/spec/filters/anonymize.rb index 94fb06958..0c7057727 100644 --- a/spec/filters/anonymize.rb +++ b/spec/filters/anonymize.rb @@ -4,24 +4,6 @@ require "logstash/filters/anonymize" describe LogStash::Filters::Anonymize do extend LogStash::RSpec - describe "anonymize string with SHA alogrithm" do - # The logstash config goes here. - # At this time, only filters are supported. - config <<-CONFIG - filter { - anonymize { - fields => ["clientip"] - key => "longencryptionkey" - algorithm => 'SHA' - } - } - CONFIG - - sample "@fields" => {"clientip" => "123.123.123.123"} do - insist { subject["clientip"] } == "0d01b2191194d261fa1a2e7c18a38d44953ab4e2" - end - end - describe "anonymize ipaddress with IPV4_NETWORK algorithm" do # The logstash config goes here. # At this time, only filters are supported.