Getting Data In

Mask a particular field in csv data at Index time

I have a csv data that contains some sensitive information like client ip. Here is how one of the rows of the data looks:

David, London,...several more columns...,

What I want is to mask the IP replacing it with the string "XXXXXXX" so that it produces, for the above row:

David, London, ...several more columns..., XXXXXXX

Also, this operation needs to be performed at index-time.

I have tried setting up transforms in prop.conf and transform.conf:

TRANSFORMS-masking = pii-mask

REGEX = .*

However, even after doing this, the IP still comes up. Can anybody tell me how to fix this issue?

It seems to me that the fields have not been extracted when the transforms are run. If this is the case, how should I get extraction done before transformation?

One of the columns in the data is address. This field can contain arbitrary number of commas, for example: "#221, Baker Street, London, England". So, I can't use a simple regular expression in sed. Instead, what I want to know is how to do transforms on extracted field rather than on the _raw field.

0 Karma

Super Champion

if you want to do masking on extracted field while displaying then you can use below spl query:

<base search>| replace * WITH XXXXXX IN ClientIP
0 Karma

I want to do masking at index time, not search time

0 Karma


Try this (need the serial no at which the field appears on CSV, I'm assuming 15, adjust accordingly)

SEDCMD-masking = s/^(([^\,]+,){14})(\d+\.\d+\.\d+\.\d+)/\1XX.XX.XX.XX/
0 Karma

Ya, this will work. But, I want to operate on the extracted field rather than on the _raw key. Is there any way I can use an extracted field in my SOURCE_KEY attribute?

0 Karma

Super Champion

Try following simple SED example here:

transforms.conf -

REGEX = (?m)^(.*)ClientIP=\d+\.\d+\.\d+\.\d+(.*)$
FORMAT = $1ClientIP=########$2
DEST_KEY = _raw

props.conf -

TRANSFORMS-anonymize = ClientIP-anonymizer

Hope this helps!

0 Karma