Splunk Search

Limit in manual editing regex

javo
Explorer

Hello there

What I'm doing is extracting fields from my log file and every entry has about 20 fields separated by commas, some of them empty. Something like this:

FULL,34,32136783,2012-03-07 14:23:43,120,,0,4|0|65|1|02,no_failure,,,,,,,no_text,10%,145432236,15-47658995,-1

(Please note the repeated commas twice, that's not a typing mistake. Those are empty fields)

It happens that I need to edit manualy the regex because the automatic recognition doesn't work well, but the windows dialog that opens by clicking 'Edit' doesn't let me write the very long regular expression I need. I can write exactly 200 characters and my regex is at least two times longer. And there you go:

^(?P<FIELDNAME1>[^,]+),(?P<FIELDNAME2>[^,]+),(?P<FIELDNAME3>[^,]+),... and so on 20 times

So, does anyone know how to solve this inconvenient? Another way to tell Splunk to extract those 20 fields? Or perhaps an equivalent, shorter regex?

Thank you whoever helps!

Tags (3)
0 Karma
1 Solution

sbrant_splunk
Splunk Employee
Splunk Employee

Using props and transforms in this case is the right thing to do, if you can. An alternative, if you were to not have access, may be to use multiple extractions to get all of the fields, using a regex such as this:

^(?:(?<field1>[^,]*),){1}             # catches the first field
^(?:(?<field2>[^,]*),){2}             # catches the second field
.
.
.
^(?:(?<field20>[^,]*),){20}            # 20

View solution in original post

0 Karma

sbrant_splunk
Splunk Employee
Splunk Employee

Using props and transforms in this case is the right thing to do, if you can. An alternative, if you were to not have access, may be to use multiple extractions to get all of the fields, using a regex such as this:

^(?:(?<field1>[^,]*),){1}             # catches the first field
^(?:(?<field2>[^,]*),){2}             # catches the second field
.
.
.
^(?:(?<field20>[^,]*),){20}            # 20
0 Karma

Drainy
Champion

Props.conf
[host::foo]
TRANSFORMS-foo=netscreen-error-field

Transforms.conf
[netscreen-error-field]
REGEX = device_id=[w+](?[^:]+)
FORMAT = err_code::$1

I've just edited one part from the docs. They are written by users so they are what a regular user would write.

0 Karma

javo
Explorer

I don't know, I just want to see something.

0 Karma

Ayn
Legend

What are you missing from the examples? They look very much like what I would write something as a 'regular user'.

javo
Explorer

Could anyone show me a user-made props.conf, or at least a piece of it?
I know there is an example in Splunk's directory but it would be much better for me to see something made by a user.

0 Karma

Ayn
Legend

Do you have shell access on the Splunk server? Because what you do in the field extractor in the web interface ultimately ends up in a props.conf / transforms.conf file. By editing that file directly you won't have any problems with limits like this.

javo
Explorer

Yes, I do have access. Should I edit both files?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...