Splunk Search

How to configure transforms.conf and regex to only index lines that do not start with "aa" and send these lines to an index called "AAA"?

abhayneilam
Contributor

Hi,

I have a file which has a data in which many lines are starting with "aa", so I don't want to index all the lines starting with "aa", I only want to index those lines which are not starting with "aa" and also I want these lines to be indexed in a particular index called "AAA". So I want a configuration for this in transforms.conf.

Thanks in advance !!

0 Karma
1 Solution

somesoni2
Revered Legend

Try this in your props.conf

[YourSourcetype]
SEDCMD-removeextra = s/^(\s*)aa.*//
SHOULD_LINEMERGE = false
...other configs you have

This will remove all the lines which are starting with 0 or more spaces followed by aa and will index other lines. You can set your Index=AA in the inputs.conf.

View solution in original post

somesoni2
Revered Legend

Try this in your props.conf

[YourSourcetype]
SEDCMD-removeextra = s/^(\s*)aa.*//
SHOULD_LINEMERGE = false
...other configs you have

This will remove all the lines which are starting with 0 or more spaces followed by aa and will index other lines. You can set your Index=AA in the inputs.conf.

abhayneilam
Contributor

Many thanks it helped me to get the desired result !!

0 Karma

kml_uvce
Builder

make these changes:

in props.conf
[mysourcetype]
TRANSFORMS-index=sendtomyindex,donotsend

in transforms.conf

[sendtomyindex]
REGEX=.
DEST_KEY=_MetaData:Index
FORMAT=AAA
WRITE_META=true
[donotsend]
REGEX=^[\s\t]+aa.*
DEST_KEY = queue
FORMAT = nullQueue

0 Karma

abhayneilam
Contributor

and moreover in my question it was that .. I want to index all those lines which are not starting with 'aa' I mean a combination of space and tab followed by "aa"

0 Karma

abhayneilam
Contributor

I have just seen that my patter is something like :

    aa yes it is good
    aa he he not bad

So every time before "aa" there is a space or tab I dont know but there is a blank. so it means a line is starting with either space or tab and then followed by 'aa'.

Please help in this !!

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...