Getting Data In

Is there any way to execute SEDCMD after transforms are applied?

Engager

Hi,

As far as I understand, SEDCMD is executed before TRANSFORMS.
Is there any way to make it execute after?

I'm overriding some metadata fields based on the content of a event. Current (simplified) working configs:

transforms.conf

[add_host]
REGEX = fetchinghost
FORMAT = host::$1
DEST_KEY = MetaData:Host

props.conf

[default]
TRANSFORMS-addinghost = add_host

Now, I would like to remove (or anonymize if you will) host from the original event, after it's been written to the host field. Current config, where SEDCMD works fine, but where TRANSFORMS does not (as i suppose SEDCMD removes/alters the event before TRANSFORMS' regex gets to it):

props.conf

[default]
TRANSFORMS-addinghosttometadata = add_host
SEDCMD-removinghostfromevent = s/fetchinghost/nothinghere/g

I've played around with setting priority, but with no luck.

Any help or tips would be greatly appreciated.

0 Karma
1 Solution

Splunk Employee
Splunk Employee

Hi bergs,

I think you should create another stanza in transforms.conf in the same way you performed the host overriding. Something like this:

props.conf

TRANSFORMS-1addinghost = add_host
TRANSFORMS-2removinghost = remove_host

transforms.conf

[add_host]
 REGEX = fetchinghost
 FORMAT = host::$1
 DEST_KEY = MetaData:Host

[remove_host]
 REGEX = (pattern before host)hostname(pattern after host)
 FORMAT = $1XXX$2
 DEST_KEY = _raw

You use regex to capture patterns before and after the host name in your data and replace the hostname part in FORMAT.

Hope this helps. Thanks!
Hunter

View solution in original post

Splunk Employee
Splunk Employee

Hi bergs,

I think you should create another stanza in transforms.conf in the same way you performed the host overriding. Something like this:

props.conf

TRANSFORMS-1addinghost = add_host
TRANSFORMS-2removinghost = remove_host

transforms.conf

[add_host]
 REGEX = fetchinghost
 FORMAT = host::$1
 DEST_KEY = MetaData:Host

[remove_host]
 REGEX = (pattern before host)hostname(pattern after host)
 FORMAT = $1XXX$2
 DEST_KEY = _raw

You use regex to capture patterns before and after the host name in your data and replace the hostname part in FORMAT.

Hope this helps. Thanks!
Hunter

View solution in original post

Engager

Thanks Hunter,

This was exactly what I needed 🙂

0 Karma

Revered Legend

Can you try performing your data anonymization in transforms.conf only.

https://docs.splunk.com/Documentation/Splunk/6.5.1/Data/Anonymizedata#Configure_transforms.conf

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!