Description
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
A new ottl function/converter when invoked will transform the underlying telemetry data to a hash value or digest.
Hashing is commonly used for
- data integrity checks
- password storage (where the password itself is not stored but its hash value is)
- verifying data authenticity.
Describe the solution you'd like
The hashing converter/function could be used with the replace_all_matches
editor like below
- replace_all_matches(target, pattern, sha256)
- replace_all_matches(target, pattern, sha1)
The replace_all_matches function replaces any matching string value with its hash value.
target
is a path expression to a pdata.Map
type field. pattern is a string following filepath.Match syntax.sha1
is the hashing function.
Each string value in target that matches pattern will get replaced with its hash value. Non-string values are ignored.
We could define two hash functions for the following two algorithms
- SHA-256
- SHA-1 (the attributes processor uses this)
or with the set
editor like below
- set(target, hash(value))
Describe alternatives you've considered
An alternative to using this could be to use the attributes processor
With the hash action
# Key specifies the attribute to act upon.
- key: <key>
action: hash
# Rule specifies the regex pattern for attribute names to act upon.
pattern: <regular pattern>
Additional context
No response