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!

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...