Getting Data In

How to override the host and indexer if they are from a specific IP address?

Federica_92
Communicator

Hi everyone,

I would like overwrite the host and indexer coming from my Splunk universal forwarder in my main indexer if they are from a specific IP address.
The logs are coming from an internal network, so the fields IP are between 10.30.75.1 and 10.30.76.100.

I write down a props.conf and a transforms.conf, but they are not actually working. Could someone help me?

props:

 [subnetwork1]
 EXTRACT-extract_ip = (?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
 TRANSFORMS-subnetwork1=subnetwork1

transforms:

[subnetwork1]
REGEX = (?<ip>\10\.\30\.\*\.\*)
FORMAT = host::$1
INDEX=subnetwork1

Could someone help me?

0 Karma
1 Solution

bmacias84
Champion

Only heavy forwarders and Indexer have the ability to overwrite meta fields

To overwrite index your transform needs to look something like this

#transfroms.conf
[index_rename]
REGEX = (\10\.\30\.\*\.\*)
DEST_KEY = _MetaData:Index
FORMAT = subnetwork1

[host_rename]
REGEX = (\10\.\30\.\*\.\*)
DEST_KEY = _MetaData:Host
FORMAT = $1

#props.conf
[mySourcetype]
TRANSFORMS-renames = host_rename, index_rename

View solution in original post

hgrow
Communicator

Hi Federica,
you are pretty close. Fieldtransformation is done on your indexer (or a heavy forwarder). The following configuration should work:

props.conf

 [test]
 TRANSFORMS-ipextraction = ip-extraction

transforms.conf

 [ip-extraction]
 DEST_KEY = MetaData:Host
 REGEX =(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
 FORMAT = $1

In the props.conf [test] is the sourcetype of your input. I assume you have to change it to [subnetwork1], if thats the sourcetype of your input.

I hope it helps.

Greetings

Federica_92
Communicator

Thank you! 🙂

0 Karma

bmacias84
Champion

Only heavy forwarders and Indexer have the ability to overwrite meta fields

To overwrite index your transform needs to look something like this

#transfroms.conf
[index_rename]
REGEX = (\10\.\30\.\*\.\*)
DEST_KEY = _MetaData:Index
FORMAT = subnetwork1

[host_rename]
REGEX = (\10\.\30\.\*\.\*)
DEST_KEY = _MetaData:Host
FORMAT = $1

#props.conf
[mySourcetype]
TRANSFORMS-renames = host_rename, index_rename

hgrow
Communicator

bmacias84 was faster 🙂

0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...