summaryrefslogtreecommitdiffstats
path: root/source/rainerscript/functions/mo-hashXXmod.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:27:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:27:18 +0000
commitf7f20c3f5e0be02585741f5f54d198689ccd7866 (patch)
tree190d5e080f6cbcc40560b0ceaccfd883cb3faa01 /source/rainerscript/functions/mo-hashXXmod.rst
parentInitial commit. (diff)
downloadrsyslog-doc-f7f20c3f5e0be02585741f5f54d198689ccd7866.tar.xz
rsyslog-doc-f7f20c3f5e0be02585741f5f54d198689ccd7866.zip
Adding upstream version 8.2402.0+dfsg.upstream/8.2402.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--source/rainerscript/functions/mo-hashXXmod.rst48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/rainerscript/functions/mo-hashXXmod.rst b/source/rainerscript/functions/mo-hashXXmod.rst
new file mode 100644
index 0000000..8fc1d77
--- /dev/null
+++ b/source/rainerscript/functions/mo-hashXXmod.rst
@@ -0,0 +1,48 @@
+*********
+HashXXmod
+*********
+
+Purpose
+=======
+
+Generates a number which is mod of given string's hash.
+
+hash32mod(literal_string, modulo) / hash32mod(literal_string, modulo, seed)
+---------------------------------------------------------------------------
+
+ Generates a number which is calculated on (32 bit hash of the given string % modulo)
+ - If modulo is not a valid number, then 0 is returned.
+ - If modulo is 0, then 0 is returned.
+ - Seed is an optional parameter with default = 0.
+ - If seed is not a valid unsigned number, then 0 is returned.
+
+
+hash64mod(literal_string, modulo) / hash64mod(literal_string, modulo, seed)
+---------------------------------------------------------------------------
+
+ Generates a number which is calculated on (64 bit hash of the given string % modulo)
+ - If modulo is not a valid number, then 0 is returned.
+ - If modulo is 0, then 0 is returned.
+ - Seed is an optional parameter with default = 0.
+ - If seed is not a valid unsigned number, then 0 is returned.
+
+
+.. warning::
+
+ - Default hash implementation is non-crypto.
+ - To use xxhash enable compile time flag.
+
+
+Example
+=======
+
+.. code-block:: none
+
+ module(load="fmhash")
+
+ if (hash64mod($!msg!request_id, 100) <= 30) then {
+ //send out
+ }
+
+.. seealso::
+ :doc:`Hash based sampling<../../tutorials/hash_sampling>`