Closed naturtrunken closed 5 years ago
Hey @naturtrunken, thanks for the PR and including a test 💯The code looks clean, but I don't necessarily want to pull the hashing code into this gem. I've been thinking about how to make it more customizable and am leaning towards something like this:
scrubber = lambda do |line|
line.gsub(IP_REGEX) { |v| IpAnonymizer.hash_ip(v, key: key) }
end
Logstop.guard(logger, scrubber: scrubber)
What are your thoughts?
Went ahead and added the scrubber
option as a more flexible alternative. Thanks again for the PR 👍
I needed to keep logfiles for a longer time period, but without the real IP addresses. Your ip_anonymizer gem looked great, but I could not integrate it directly to anonymize the IP addresses in the Rails logs. So I added the hashing function from the ip_anonymizer gem to this gem.
Of course I could also adding the masking method here, but I don't need it currently and I didn't want to copy more methods from your other gem.