Splunk Search

How do you build a regex to index only specific files?

sarit_s
Communicator

Hello,

i have these 3 stanzas in my transforms.conf file:

[set_f270_header]
REGEX = (^\$\w+\s\d+|^\-\-\-\-\-  header)
FORMAT = sourcetype::f270_header
DEST_KEY = MetaData:Sourcetype

[set_f270_system]
REGEX = (^\w{3}\s+\d+\s\d{2}|^\-\-\-\-\-  System Log)
FORMAT = sourcetype::f270_system
DEST_KEY = MetaData:Sourcetype

[set_f270_joblog]
REGEX = (^\$\w+\s\d+|^\-\-\-\-\-  joblog)
FORMAT = sourcetype::f270_joblog
DEST_KEY = MetaData:Sourcetype

my files names are for example:

037388b4-0f12-410e-a8ab-a795e9244e22.sanitized.joblog

130dab3c-3e62-45a0-aefe-f160c0dd3325_header

73dc67bc-db07-49d5-a12c-a1ed12f54fee_System+Log

Beside them, i have more file types, but I don't want to index them right now.

My problem is that the files are not indexed correctly and I got all the file types in my sourcetype

What am I doing wrong ?

Tags (2)
0 Karma
1 Solution

nickhills
Ultra Champion

It seems to me that you would be better configuring this as 3 stanzas in your inputs.conf, rather than props/transforms.

[monitor://your/path/*_header]
sourcetype=f270_header

[monitor://your/path/*_System+Log]
sourcetype=f270_system

[monitor://your/path/*joblog]
sourcetype=f270_job
If my comment helps, please give it a thumbs up!

View solution in original post

0 Karma

nickhills
Ultra Champion

It seems to me that you would be better configuring this as 3 stanzas in your inputs.conf, rather than props/transforms.

[monitor://your/path/*_header]
sourcetype=f270_header

[monitor://your/path/*_System+Log]
sourcetype=f270_system

[monitor://your/path/*joblog]
sourcetype=f270_job
If my comment helps, please give it a thumbs up!
0 Karma

sarit_s
Communicator

solved by doing something similar in s3 inputs.conf
add it as whitelist

0 Karma

sarit_s
Communicator

my inputs are from s3
i tries this but it didnt work

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