Splunk Search

extract fields from a sentence

newbiesplunk
Path Finder

Hi,
I had the following sentence and wish to extract fields as follows:

event Row: 1234, tp1, 314242, 1, 2014-09-27 12:00:19.0, track, 55444, test

Below is the fields to extract from the above event.

Key      Value
S_ID     1234
type     tp1
B_ID     314242
mode   1
B_date  2014-09-27 12:00:19.0
name    track
c_ID      55444
c_name test

How to go abt extracting the fields in the most simplest way? thks

Tags (1)
0 Karma

kristian_kolb
Ultra Champion

Do it in the form of a REPORT in props/transforms.

props.conf

[your_sourcetype]
REPORT-blah = get_my_fields

transforms.conf

[get_my_fields]
DELIMS = ","
FIELDS = S_ID, type, B_ID, mode, B_date, name, c_ID, c_name

/K

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try this

Your base search | rex "(?<S_ID>.*),(?<type>.*),(?<B_ID>.*),(?<mode>.*),(?<B_date>.*),(?<name>.*),(?<C_ID>.*),(?<C_name>.*)"
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...