-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from logmanager-oss/implement-per-session-repl…
…acement-map implement persistent (per session) replacement map
- Loading branch information
Showing
10 changed files
with
119 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,35 @@ func TestAnonimizer_AnonymizeData(t *testing.T) { | |
}, | ||
expectedOutput: "2024-06-05T14:59:27.000+00:00, 10.20.0.53, 8186:39ac:48a4:c6af:a2f1:581a:8b95:25e2, ladislav.dosek, Apple, 0f:da:68:92:7f:2b, [email protected], http://soqovkq.com/NfkcUjG.php, with_that", | ||
}, | ||
{ | ||
name: "Test AnonymizeData - with persisten replacement map", | ||
anonymizationDataDir: "../../tests/data/anonymization_data", | ||
customAnonymizationMappingPath: "../../tests/data/custom_mappings.txt", | ||
input: map[string]string{ | ||
"@timestamp": "2024-06-05T14:59:27.000+00:00", | ||
"src_ip": "10.10.10.1", | ||
"src_ipv6": "7f1d:64ed:536a:1fd7:fe8e:cc29:9df4:7911", | ||
"mac": "71:e5:41:18:cb:3e", | ||
"email": "[email protected]", | ||
"url": "https://www.testurl.com", | ||
"username": "miloslav.illes", | ||
"organization": "Microsoft", | ||
"custom:": "replacement_test", | ||
"raw": "2024-06-05T14:59:27.000+00:00, 10.10.10.1, 7f1d:64ed:536a:1fd7:fe8e:cc29:9df4:7911, miloslav.illes, Microsoft, 71:e5:41:18:cb:3e, [email protected], https://www.testurl.com, replace_this", | ||
}, | ||
expectedOutput: "2024-06-05T14:59:27.000+00:00, 10.20.0.53, 8186:39ac:48a4:c6af:a2f1:581a:8b95:25e2, ladislav.dosek, Apple, 0f:da:68:92:7f:2b, [email protected], http://soqovkq.com/NfkcUjG.php, with_that", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
anonymizer, err := CreateAnonymizer(&config.Config{AnonymizationDataPath: tt.anonymizationDataDir, CustomAnonymizationMappingPath: tt.customAnonymizationMappingPath}, &proof.ProofWriter{IsEnabled: false}) | ||
anonymizer, err := CreateAnonymizer( | ||
&config.Config{ | ||
AnonymizationDataPath: tt.anonymizationDataDir, | ||
CustomReplacementMapPath: tt.customAnonymizationMappingPath, | ||
}, | ||
&proof.ProofWriter{IsEnabled: false}, | ||
) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package proof | ||
|
||
const ( | ||
ProofFilename = "proof.ndjson" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.