Splunk Search

Fix-width field extraction with multiple line value in one column

Takol1
Explorer

Our customer has a log file with fix-width layout as below,

10/4/12  18:00:00  10/4/12  18:00:31  ABCDEFGHIJKLM-   Completed
                                      NOPQ
10/4/12  18:00:01  10/4/12  18:00:22  1234567890123-   Completed
                                      456

It expect a field, let's say "name", be extracted with value "ABCDEFGHIJKLNOPQ" and "1234567890123456". How do we use transform or anything else to parse it?

Tags (1)
0 Karma

MHibbin
Influencer

Are they two different events?

You should be able to use something like the following to test the extraction on your data: (example using rex from search commands and piping to stats for demo)

* | rex field=_raw "\d+\:\d+\:\d+\s+(?P<name>\w+)\-\s+" | stats count by name

The easiest way for you to set up the extraction is using the IFX (Interactive Field eXtractor), please see follow:

http://docs.splunk.com/Documentation/Splunk/5.0/Knowledge/ExtractfieldsinteractivelywithIFX

Or you can create field extractions in conf files, please see following:

http://docs.splunk.com/Documentation/Splunk/5.0/Knowledge/Createandmaintainsearch-timefieldextractio...

0 Karma

Takol1
Explorer

Thanks for your answer. The event contains two lines and the field "ABCDEFGHIJKLM-" and "NOPQ" are located at separated two lines.

So there are two questions in this case exactly. First, how to extract column field from multiple lines? Second, how to tell between hyphen and dash?

0 Karma
Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...