Getting Data In

Route events to different indexes based on hostname

Abha111
Loves-to-Learn Lots

Hi, 

 

I want to send data to x index if the host is non prod and host name is like abc-nprd* for  /var/log

However, would like to send data to y index if host is prod and host name is like abc-prd* for /var/log

Don't want to create multiple apps for prod and non prod. So is there is way I can achieve the above by deploying the same app to prod and non prod.  

Any help appreciated. 

Thanks.

 

Labels (1)
0 Karma

bhargavi
Path Finder

Hi @Abha111 ,

Will the host name parameter come inside the events as well? If yes. you can simply define a regex in transforms.conf to route it to specific index.

Example below.

props.conf

[your_sourcetype]
enter your props
TRANSFORMS-routing=set_nonprod,setprod

transforms.conf
[set_nonprod]
REGEX = abc-nprd*
DEST_KEY = _MetaData:Index
FORMAT = index_x

[setprod]
REGEX = abc-prd*
DEST_KEY = _MetaData:Index
FORMAT = index_y

Try this. Let me know for any further questions. If this works, give thumbs-up 🙂

Happy Splunking!! 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...