Getting Data In

Field Extraction

gjohnson
New Member

I am trying to extract a field from the following lines but the field extraction does not result in a Field. The sample data is a CSV download from a credit card site:

02/14/2013 Thu,,"PIZZA HUT # 023603 0MC LEAN VA ","GEORGE T JOHNSON","XXXX-XXXXXX-82003",,,28.75,,,,,,,
02/15/2013 Fri,,"BONSAI GRILL 1234560ARLINGTON VA ","GEORGE T JOHNSON","XXXX-XXXXXX-82003",,,32.21,,,,,,,
02/15/2013 Fri,,"EXXONMOBIL MCLEAN VA ","GEORGE T JOHNSON","XXXX-XXXXXX-82003",,,57.28,,,,,,,

The field I am looking for has the values of "28.75, 32.21, 57.28" values. I did an automated field extract by copying out the value, putting it in the sample and generating a regex - it successfully identifies the information I want (it is highlighted). I hit save then go back to searching, but the field doesn't extract.

I then tried copying the rex pattern that successfully identified the fields in the auto-generator (see the rex below) and I ran it right on the search bar - but it brought back a sparse return (there wasn't a price field for every line like there should be).

running this yields inconsistent results
... | rex "(?i)^(?:[^\-]*\-){3}\d+\",,,(?P[^,]+)"

Can anyone help me with the right regex for a field extraction that yields a "price" for every line in the file?

Tags (3)
0 Karma

somesoni2
Revered Legend

Could you please try below rex.

"(?i)^(?:[^,]*,){7}(?P[^,]+)"

0 Karma

bizza
Path Finder

Hi gjohnson,
why you are not putting that csv in inputs.conf, defining a TRANSFORM in props.conf, defining a field DELIM on your transforms.conf and the assign the right field to the different column?

ciao

bizza
Path Finder

something like this

inputs.conf

[monitor:///path/to/file.csv]
sourcetype = yoursourcetype
disabled = 0

props.conf

[sourcetype::yoursourcetype]
CHECK__FOR _HEADER=TRUE
SHOULD _LINEMERGE = false
TRANSFORM-transformfile = transf_csv

transforms.conf

[transf_csv]
DELIMS=","
FIELDS="field1", "field2", "field3", "field4", "fieldN"

0 Karma

gjohnson
New Member

Sorry, I am not sure I know what you are saying. I did put the CSV in as a file input. I thought that the Field Extraction process would create a delimeter? Am I wrong?

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!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...