If you want to mask fields of data as you ingest from a source into Kafka, or write to a sink from Kafka with Kafka Connect, the MaskField Single Message Transform is perfect for you. It retains the fields whilst replacing its value.
To use the Single Message Transform you specify the field to mask, and its replacement value. To mask the contents of a field called cc_num you would use:
" transforms " : " maskCC " ,
" transforms.maskCC.type " : " org.apache.kafka.connect.transforms.MaskField$Value " ,
" transforms.maskCC.fields " : " cc_num " ,
" transforms.maskCC.replacement " : " --- "