Getting Data In

How use the transform.conf to filter event value and Host

rex_rafa
New Member

I have an index receiving events from some hosts, I create a new index and need to send for this new index data that contains the work debug, I create this rule bellow and work.

[ABC]
REGEX = debug
DEST_KEY = _MetaData:Index
FORMAT = debug

The problem is I need to send this event to new index only it has the word debug and specific hosts.
If debug and host=xxx send for index debug if have only debug still sending for the old index.

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi rex_rafa,
you could try to use your transformation for the hosts to filter, in other words:
in props.conf:

[host::xxx]
TRANSFORMS-override_index=override_index

In transforms.conf:

[override_index]
REGEX = debug
DEST_KEY = _MetaData:Index
FORMAT = debug

Ciao.
Giuseppe

View solution in original post

rex_rafa
New Member

I use that and work, but I don't know why, but some events sting going for the other index, In 20 events 18 went to correct index and 2 for the wrong index.
I cant understand why it's happening,

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi rex_rafa,
you could try to use your transformation for the hosts to filter, in other words:
in props.conf:

[host::xxx]
TRANSFORMS-override_index=override_index

In transforms.conf:

[override_index]
REGEX = debug
DEST_KEY = _MetaData:Index
FORMAT = debug

Ciao.
Giuseppe

gcusello
SplunkTrust
SplunkTrust

Hi rex_rafa,
check the regex, usually this is the problem.
Then check the hostname.

Ciao.
Giuseppe

0 Karma

rex_rafa
New Member

Do you know if have any way to see the logs of this transforms.conf?
Because If I get the events and use the https://regexr.com/ to validate the regex, the regex is correct.
The host is correct too, but is strange, because just few events are going to the wrong index.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi rex_rafa,
About the regex check you can do it also in Splunk Search App using the regex command, sometimes, there''s something different.

Anyway, did you checked regex and host values at the same time?
you could use something like this:
| index=wrong_index
| regex "debug"
| table _time host _raw
In this way you can check if events with "debug" have the correct host value or a different one.

Ciao.
Giuseppe

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Request for Professional Development: Attending .conf26

Winning Over the Boss: Your Pass to .conf26 conf26 is going to be here before you know it. If don't already ...