Getting Data In

partially rewrite event index name based on sourcetype value

sylbaea
Communicator

Hello,

I already know how to statically rewrite the index value based on a sourcetype.
Typically using something similar to:
https://answers.splunk.com/answers/246672/how-can-i-override-an-index-name-based-on-sourcety.html?ut...

But I have today a slightly more complex need.

events are generated on a HF as following:
- index = prefix-environment-default
- sourcetype = (5 different values)

per sourcetype, I need to rewrite the index as following:
- if sourcetype = sourcetype1 then "default" suffix in index name should be replaced by something else specific to this index
- but (this is the part I have not find how to manage yet)... the first part of the original index name should be changed... especially, the middle part (environment) will vary and should remain intact.

is it possible to apply kind of regex/sed to capture the "default" suffix and replace it by the suffix that match a given sourcetype ?
Then I would duplicate the transform to have one per sourcetype

Thanks.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...