CONFLUENT PLATFORM
The following provides usage information for the Apache Kafka® SMT org.apache.kafka.connect.transforms.MaskField.
org.apache.kafka.connect.transforms.MaskField
Can be used for the following scenarios:
replacement
Use the concrete transformation type designed for the record key (org.apache.kafka.connect.transforms.MaskField$Key) or value (org.apache.kafka.connect.transforms.MaskField$Value).
org.apache.kafka.connect.transforms.MaskField$Key
org.apache.kafka.connect.transforms.MaskField$Value
This configuration snippet shows how to use MaskField to mask the value of a field.
MaskField
"transforms": "MaskField", "transforms.MaskField.type": "org.apache.kafka.connect.transforms.MaskField$Value", "transforms.MaskField.fields": "string_field"
This masks string_field, transforming the original message as seen here:
string_field
{"integer_field":22, "string_field":"foo"}
into the result here:
{"integer_field":22, "string_field":""}
This configuration snippet shows how to use MaskField to replace the value of a field. There are three transformations in the example. The first and second replace a value in a single field. The third is applied to both office and mobile phone number fields.
office
mobile
"transforms": "SSNMask,IPMask,PhoneMask", "transforms.SSNMask.type": "org.apache.kafka.connect.transforms.MaskField$Value" "transforms.SSNMask.fields": "SSN" "transforms.SSNMask.replacement": "***-***-****" "transforms.IPMask.type": "org.apache.kafka.connect.transforms.MaskField$Value" "transforms.IPMask.fields": "IPAddress" "transforms.IPMask.replacement": "xxx.xxx.xxx.xxx" "transforms.PhoneMask.type": "org.apache.kafka.connect.transforms.MaskField$Value" "transforms.PhoneMask.fields": "office,mobile" "transforms.PhoneMask.replacement": "+0-000-000-0000"
fields
Transformations can be configured with predicates so that the transformation is applied only to records which satisfy a condition. You can use predicates in a transformation chain and, when combined with the Filter (Apache Kafka), predicates can conditionally filter out specific records. For details and examples, see Predicates.