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

kamal singh bisht
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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...