Getting Data In

Can you apply transforms to all events meant for a specific index?

ricotries
Communicator

In my testing environment I have three main indexes that are specific to the data stored within them. I want to change the host value of all events by appending a string at the end of the host at index time (similar to a domain name, as an example) and I know how to do this with the props-transforms configuration, but I can only do it based on sourcetype, host, or source. Is there a way to do the same thing but based on index?

For example,

index1: host -> host.test1, something -> something.test1
index2: tmp -> tmp.test2
index3: hello -> hello.test3

I know how to do this based on the host field, for example:
Props.conf

[host::*]
TRANSFORMS-appendname = append_name

Transforms.conf

[append_name]
SOURCE_KEY = MetaData:Host
REGEX = (.*)
FORMAT = $1.test
DEST_KEY = MetaData:Host

And in this case, every host that forwards logs to my indexer would have their events stored as

host = hostname.test

How do I do the same thing but based on the target index?

0 Karma
1 Solution

to4kawa
Ultra Champion

transforms.conf

 [append_name]
 INGEST_EVAL = host=case(index="index1", host.".test1", index="index2", host.".test2", index="index3", host.".test3", true(), host)
 WRITE_META = true

INGEST_EVAL can be used as eval
How about this?

View solution in original post

0 Karma

to4kawa
Ultra Champion

transforms.conf

 [append_name]
 INGEST_EVAL = host=case(index="index1", host.".test1", index="index2", host.".test2", index="index3", host.".test3", true(), host)
 WRITE_META = true

INGEST_EVAL can be used as eval
How about this?

0 Karma

ricotries
Communicator

I was not aware of that setting. Because it works exactly like eval you can do the following then:

[append_name]
INGEST_EVAL = host=case(index="index1", host.".test1", index="index2", host.".test2", index="index3", host.".test3", true(), host)
WRITE_META = true

Take note that to concatenate the host value and a string you have to type a period before the string.

host."<string>" = host<string>
host.".<string>" = host.<string>

If you change your answer with the revised working (I tested it) eval declaration, I'll accept it.

0 Karma

to4kawa
Ultra Champion

I see, My answer is updated.

0 Karma
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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...