Sample project to demonstrate how to use AWS SDK for Amazon Comprehend to detect and redact PII data from logs generated by Java applications
SensitiveDataPolicy.java
uses AWS SDK to call Amazon Comprehend -
DetectPiiEntitiesRequest piiEntitiesRequest =
DetectPiiEntitiesRequest.builder()
.languageCode("en")
.text(msg.getFormattedMessage())
.build();
DetectPiiEntitiesResponse piiEntitiesResponse = comprehendClient.detectPiiEntities(piiEntitiesRequest);
log4j.xml
uses parameters to configure the appllication -
<Rewrite name="Rewrite">
<SensitiveDataPolicy
maskMode="MASK"
mask="*"
minScore="0.9"
entitiesToReplace="SSN,EMAIL"
/>
<AppenderRef ref="Console" />
</Rewrite>
All these parameters are custom to this application, feel free to create your own parameters and customize the SensitiveDataPolicy
. The entity types SSN,EMAIL
come from Amazon Comprehend documentation.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.