HashXX¶
Purpose¶
Generates hash for a given string.
hash32(literal_string) / hash32(literal_string, seed)¶
- Generates a 32 bit hash of the given string.
Seed is an optional parameter with default = 0.
If seed cannot be converted to a number, then 0 is returned.
hash64(literal_string) / hash64(literal_string, seed)¶
- Generates a 64 bit hash of the given string.
Seed is an optional parameter with default = 0.
If seed cannot be converted to a number, then 0 is returned.
Seed conversion¶
After RainerScript converts the seed to a number, that number is converted to
an unsigned 32-bit integer before hashing. For values representable as
RainerScript numbers, negative seeds and seeds greater than 4294967295 wrap
modulo 4294967296. For example,
-1 and 4294967295 select the same seed, and 4294967296 selects
seed 0. Decimal numeric strings are accepted with the same conversion.
Warning
Default hash implementation is non-crypto.
To use xxhash enable compile time flag.
Example¶
module(load="fmhash")
set $.hash = hash64($!msg!field_1 & $!msg!field_2 & $!msg!field_3)
set $!tag= $syslogtag & $.hash;
//send out
See also
Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project
Contributing: Source & docs: rsyslog source project
© 2008–2026 Rainer Gerhards and others. Licensed under the Apache License 2.0.