mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Merge pull request #289 from Fewbytes/anonymize
Removed warn statements, replaced ipaddress with ipaddr
This commit is contained in:
commit
1b160689a9
2 changed files with 2 additions and 8 deletions
|
@ -22,7 +22,7 @@ class LogStash::Filters::Anonymize < LogStash::Filters::Base
|
|||
# require any library and set the anonymize function
|
||||
case @algorithm
|
||||
when "IPV4_NETWORK"
|
||||
require "ipaddress"
|
||||
require 'ipaddr'
|
||||
class << self; alias_method :anonymize, :anonymize_ipv4_network; end
|
||||
when "MURMUR3"
|
||||
require "murmurhash3"
|
||||
|
@ -43,20 +43,15 @@ class LogStash::Filters::Anonymize < LogStash::Filters::Base
|
|||
|
||||
private
|
||||
def anonymize_ipv4_network(ip_string)
|
||||
warn "ipv4"
|
||||
ip = IPAddress::IPv4.new(ip_string)
|
||||
ip.prefix = @key
|
||||
ip.network.to_s
|
||||
IPAddr.new(ip_string).mask(@key.to_i).to_s
|
||||
end
|
||||
|
||||
def anonymize_openssl(data)
|
||||
warn "openssl"
|
||||
digest = algorithm()
|
||||
OpenSSL::HMAC.hexdigest(digest, @key, data)
|
||||
end
|
||||
|
||||
def anonymize_murmur3(value)
|
||||
warn "murmur3"
|
||||
case value
|
||||
when Fixnum
|
||||
MurmurHash3::V32.int_hash(value)
|
||||
|
|
|
@ -58,7 +58,6 @@ Gem::Specification.new do |gem|
|
|||
gem.add_runtime_dependency "geoip", [">= 1.1.0"]
|
||||
gem.add_runtime_dependency "beefcake", "0.3.7"
|
||||
gem.add_runtime_dependency "php-serialize" # For input drupal_dblog
|
||||
gem.add_runtime_dependency "ipaddress"
|
||||
gem.add_runtime_dependency "murmurhash3"
|
||||
|
||||
if RUBY_PLATFORM == 'java'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue