Computes a cryptographic SHA1-hashing of the given input field or array of fields. The hashed output is returned as a hex string, meaning the hexadecimal representation of the SHA1 hash of data.

This function can be used to calculate checksums to compare outside of LogScale or collect multiple fields into a combined string of fixed length.

ParameterTypeRequiredDefault ValueDescription
asstringoptional[a] _sha1 The name of the output field.
field[b]array of stringsrequired   The name of the field or fields to hash.

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

[b] The parameter name field can be omitted.

Hide omitted argument names for this function

Show omitted argument names for this function

crypto:sha1() hashes the UTF-8 encoding of the fields.

When providing more than one field:

  • the function hashes the concatenation of the fields

  • if a given field is missing from an event — or if it has an empty value — it is treated as the empty string.

crypto:sha1() Examples

Click + next to an example below to get the full details.

SHA-1 Hash Multiple Fields

SHA-1 hash multiple fields using the crypto:sha1() function

SHA-1 Hash a Field With a Given Value

SHA-1 hash a field with a given value using the crypto:sha1() function