Splunk Search

How to debug transforms.conf regex errors

huaraz
Explorer

Hi

I have a logfile with different formated lines and I want to extract comon fields . My props.conf looks like:

[mylog]
TRUNCATE=0
SHOULD_LINEMERGE=false
TIME_PREFIX=(
TRANSFORMS-header_null_queue=send_header_to_nullqueue
REPORT-main=type1, type2, type3
TIME_FORMAT=%s.%6N

[send_header_to_nullqueue]
REGEX = ^#
DEST_KEY = queue
FORMAT = nullQueue

[type1]
REGEX=...

[type2]
REGEX=..

[type3]
REGEX=..

I checked using pcregextest that each regex works for my 3 types of log lines. But all together seems not to work as I don't get the fields.

Thank you
Markus

0 Karma

Runals
Motivator

I use regex101.com. Just to confirm though because it isn't in your examples

1) do your REGEX lines exist in your props.conf or your transforms.conf? Your send_header_to_nullqueue, type1 - type3 stanzas need to live in a transforms.conf
2) do your REGEX lines in type1 - 3 have a capturing group with a field name in them? For example

REGEX= I want (foo) for breakfast

has a capturing group but there is no defined field. You could do one of the approaches below

REGEX = I want (?<breakfast_food>foo) for breakfast
or
REGEX = I want (?<breakfast_food>\S) for breakfast

OR

REGEX = I want (foo) for breakfast
FORMAT = breakfast_food::$1

0 Karma

woodcock
Esteemed Legend

I use expresso:
http://www.ultrapico.com/expresso.htm

This tool allows you to paste your log text as-is into one window and paste your REGEX as-is into another window and check the results. If your REGEXs work in expresso then either there is something wrong with your configuration file organization or your (possibly incorrect expectations of) search.

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...