I'd love to see a length parameter to specify the length of the output. a short prefix might be enough for identifying a string and takes much less space. substr could be applied for sure, but this is much simpler (and faster) cool idea btw, I'll be pulling this to 3.4 after review. ----- Original message -----
On 2012-08-03, Peter Gyongyosi wrote:
tfhash: New template function to calculate the SHA1 of its input
This patch adds a new template function called $(hash) which can be used to calculate the SHA1 hash of its inputs. As it uses the SHA1() function from OpenSSL, it is only available if syslog-ng is compiled using --enable-ssl.
One use case for it can be when you'd like to anonymize sensitive parts of the log message (eg. the user name) you parsed out using patterndb before storing or forwarding it for further analysis but would like to retain the ability to correlate messages along this value.
I like this very much! Another use case would be to use $(hash) along with $(substr) to "shard" logs across multiple storage points.
I'd love to see $(hash) with an (optional?) argument specifying the digest algorithm to use, but even with just SHA-1 it's really cool (and simple).
-- Jakub Jankowski|shasta@toxcorp.com|http://toxcorp.com/ GPG: FCBF F03D 9ADB B768 8B92 BB52 0341 9037 A875 942D ______________________________________________________________________________ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.balabit.com/wiki/syslog-ng-faq