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
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 ...