Computes a non-cryptographic hash of a list of fields. The hash is returned as an integer in the range [0,4294967295]. Calling this function with the same values and the same seed (or no seed) will result in the same hash being computed. This hash is not cryptographic and should not be used to securely obscure data (instead use hashRewrite() and hashMatch() for that). This function can for example be used to reduce the number of groups in a groupBy(), at the cost of having collisions.

asstringoptional[a]_hash The output name of the field to set.
field[b]Array of stringsrequired  The fields for which to compute hash values.
limitnumberoptional[a]  An upper bound on the number returned by this function. The returned hash will be modulo this value and thus be constrained to the range [0,limit].
seedstringoptional[a]  An optional seed for the hash function.

[a] Optional parameters use their default value unless explicitly set

[b] The argument name field can be omitted.

Omitted Argument Names

The argument name for field can be omitted; the following forms of this function are equivalent:




These examples show basic structure only; full examples are provided below.

hash() Examples

Hash the field a and put the result into _hash:


Hash the fields a, b, and c and put the result modulo 10 into _hash

hash([a,b,c], limit=10)

Hash the field a (by setting field explicitly) using a seed of 10

hash(field=[a], seed=10)

Group events into 10 buckets such that all events with the same value of a ends in the same bucket.

hash(a, limit=10)
| groupby(_hash)