Skip to content

Commit

Permalink
Extend user data filtering example and tests (#356)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <[email protected]>
  • Loading branch information
bacherfl authored Nov 7, 2024
1 parent 4409698 commit c423e78
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .chloggen/add-client-address-filtering.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: transformprocessor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Extend the user data filtering example with a statement for masking the `client.address` attribute

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [356]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
3 changes: 3 additions & 0 deletions config_examples/filtering_user_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ processors:
- set(attributes["user.name"], "****")
- set(attributes["user.full_name"], "****")
- set(attributes["user.email"], "****")
# this will not only redact end user client IP addresses,
# but also the address of a server acting as a client when establishing a connection to another server
- set(attributes["client.address"], "****")
metric_statements:
- context: datapoint
statements: *filter-statements
Expand Down
2 changes: 2 additions & 0 deletions internal/testbed/integration/filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func TestFilteringUserProperties(t *testing.T) {
attributesNonMasked.PutStr("user.name", "username")
attributesNonMasked.PutStr("user.full_name", "Firstname Lastname")
attributesNonMasked.PutStr("user.email", "[email protected]")
attributesNonMasked.PutStr("client.address", "127.0.0.1")
attributesNonMasked.PutStr("safe-attribute", "foo")
attributesNonMasked.PutStr("another-attribute", "bar")

Expand All @@ -360,6 +361,7 @@ func TestFilteringUserProperties(t *testing.T) {
attributesMasked.PutStr("user.name", "****")
attributesMasked.PutStr("user.full_name", "****")
attributesMasked.PutStr("user.email", "****")
attributesMasked.PutStr("client.address", "****")
attributesMasked.PutStr("safe-attribute", "foo")
attributesMasked.PutStr("another-attribute", "bar")

Expand Down

0 comments on commit c423e78

Please sign in to comment.