Getting Data In

Heavy forwarder - routing to different indexes depending on field value

Clovisa
Path Finder

Hi everyone !

I'm new to Splunk and I'm trying to see what can be done with it. I was wondering if it was possible, with a heavy forwarder, to forward data to different indexes depending on the value of a specific field?

For example, if I have the indexes red_colored_vegetables and green_colored_vegetables, and the following data :

| Id | Vegetable    | Color |
| 1  | Tomato       | Red   |
| 2  | Leek         | Green |
| 3  | Salad        | Green |

I want that 1 is forwarded to the index red_colored_vegetables and that 2 and 3 are forwarded to the index green_colored_vegetables.
Is it feasible?

Thanks !

0 Karma
1 Solution

hortonew
Builder

I think this should get you close to what you want:

inputs.conf
[monitor://...]
index=vegetables
sourcetype=vegetables
disabled=false

transforms.conf
[rewrite_red]
DEST_KEY =_MetaData:Index
REGEX = (?i)red
FORMAT = red_colored_vegetables

[rewrite_green]
DEST_KEY =_MetaData:Index
REGEX = (?i)green
FORMAT = green_colored_vegetables

props.conf
[vegetables]
TRANSFORMS-veggieindex = rewrite_red, rewrite_green

View solution in original post

hortonew
Builder

I think this should get you close to what you want:

inputs.conf
[monitor://...]
index=vegetables
sourcetype=vegetables
disabled=false

transforms.conf
[rewrite_red]
DEST_KEY =_MetaData:Index
REGEX = (?i)red
FORMAT = red_colored_vegetables

[rewrite_green]
DEST_KEY =_MetaData:Index
REGEX = (?i)green
FORMAT = green_colored_vegetables

props.conf
[vegetables]
TRANSFORMS-veggieindex = rewrite_red, rewrite_green

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...