Mask
Synopsis
Provides data masking capabilities using various hashing functions.
Schema
mask:
- field: <ident>
- masking_rules: <rule[]>
- target_fields: <string[]>
- depth: <numeric>
- hash_type: <enum>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing sensitive data to mask |
masking_rules | Y | - | List of masking rules to apply |
target_fields | N | ["message"] | Fields to apply masking to |
depth | N | 5 | Maximum depth to traverse nested fields |
hash_type | N | sha256 | Hash algorithm to use (md5, sha1, sha256, sha512) |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue if masking fails |
ignore_missing | N | false | Continue if source field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Masking Rule Properties
Field | Required | Default | Description |
---|---|---|---|
match_regex | Y | - | Pattern to match sensitive data |
hash_type | N | sha256 | Hash algorithm for this rule |
enabled | N | true | Whether this rule is active |
keep_first | N | 0 | Number of characters to preserve from start |
keep_last | N | 0 | Number of characters to preserve from end |
Details
This processor is particularly useful for protecting sensitive data like Personally Identifiable Information (PII) by applying hash functions while optionally preserving portions of the original value.
The processor uses regular expressions to identify sensitive data. It supports multiple hash algorithms (MD5, SHA1, SHA256, SHA512) for different security requirements.
MD5 is cryptographically broken and should not be used for security purposes. It is only included for Cribl compatibility.
VirtualMetric highly recommends using at least SHA-256 for any sensitive data, which the system defaults to if no hash type is specified.
Multiple fields can be selected. The masking rules are configurable.
Empty field content is treated as non-matching. If no rules match, the field remains unchanged. Non-string field values, missing fields, and invalid regex patterns will cause errors which must be handled.
Complex regular expressions may impact performance.
Conditional execution is also available.
Examples
Basic
Masking social security numbers... |
|
preserves "social=" and hashes the numbers: |
|
Credit Cards
Masking the credit card partially... |
|
keeps the first and last 4 digits: |
|
Multiple Fields
Applying masking to multiple fields... |
|
masks all of them: |
|
Conditionals
Masking only when a condition is met... |
|
skips unmatching parts: |
|
Missing Fields
Handling missing fields gracefully... |
|
continues the execution: |
|
Hash Types
Using SHA256 specifically... |
|
applies the algorithm: |
|