Getting Data In

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

bergs
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

hunters_splunk
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

hunters_splunk
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

bergs
Engager

Thanks Hunter,

This was exactly what I needed 🙂

0 Karma

somesoni2
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
Get Updates on the Splunk Community!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...