Skip to content

Support for masking a part of string within a value #32

Description

@TejasKM

I am using the value_pattern to anonymize the value of the msg key from log. It is observed that the fluent-plugin-anonymizer hashes the entire string which ‘has’ the matching pattern.

Can you add support for hashing only the part of matching string and not the entire value?

Sample Config:
<filter **>
  @type anonymizer
  <mask sha1>
     value_pattern UserId:\d{3}-?\d{3}
  </mask>
 </filter>

Log Sample:
{ "level": "INFO", "timezone": "UTC", "threadname": "main", "msg": "Logged in UserId:123-456"}

Output:
{ "level": "INFO", "timezone": "UTC", "threadname": "main", "msg": "<hashed value>"}

Expected Output:
{"level": "INFO", "timezone": "UTC", "threadname": "main", "msg": "Logged in <hashed value>"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions