Splunk Search

Possible bug with Field Extraction, regex works fine with search but not with Field extraction

somesoni2
Revered Legend

I have an index where I have indexed a csv file with 7 fields. Following is the format of csv file. (header row)

timestamp,field1,field2,field3,field4,field5,field6

Since the fields were not automatically extracted, I 'Extract field' options of Splunk to do the same. Exception for field5, all other field extractions are working fine. For field5, I validated the regular expression generated by Splunk and it works perfectly with search (using rex command), but not with Field extraction:

EXTRACT-Field5=(?i)^(?:[^,]*,){5}(?P<Field5>[^,]+) 

Anyone has any idea if this is a possible bug with Field Extraction or any better way to extract fields from csv file. Splunk version is 5.0.5.

0 Karma
1 Solution

kristian_kolb
Ultra Champion

The best way would probably be to use a REPORT with DELIMS and FIELDS, instead of an EXTRACT;

props.conf

[your_sourcetype]
REPORT-blah = extract_csv_blah

transforms.conf

[extract_csv_blah]
DELIMS = ","
FIELDS = fieldname1, fieldname2, fieldname3, fieldname3, fieldname4, fieldname5, fieldname6, fieldname7

Read more in the docs for transforms.conf;

http://docs.splunk.com/Documentation/Splunk/5.0.1/Admin/Transformsconf

Hope this helps,

K

View solution in original post

kristian_kolb
Ultra Champion

The best way would probably be to use a REPORT with DELIMS and FIELDS, instead of an EXTRACT;

props.conf

[your_sourcetype]
REPORT-blah = extract_csv_blah

transforms.conf

[extract_csv_blah]
DELIMS = ","
FIELDS = fieldname1, fieldname2, fieldname3, fieldname3, fieldname4, fieldname5, fieldname6, fieldname7

Read more in the docs for transforms.conf;

http://docs.splunk.com/Documentation/Splunk/5.0.1/Admin/Transformsconf

Hope this helps,

K

somesoni2
Revered Legend

This seems to solve the issue. Thanks Kristian...

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...