Getting Data In

Extract fields during source type creation

jayakumar89
Explorer

I have log file that has combination of plain text and key value pairs separated by "|". How can i extract all the fields from log. below is the sample data I'm trying to index.

01/16/2017 11:09:15|SNMPv2c|hostname|IP address|0|sonusNodeServerCongestionNotification|sysUpTime : 98677211|snmpTrapOID : sonusNodeServerCongestionNotification|sonusShelfIndex : 1|sonusSlotIndex : 5|sonusOverloadLevel : 1|sonusEventDescription : Shelf 1 slot 5 card congestion level 1.|sonusEventClass : 1|sonusEventLevel : 2|sonusSequenceId : 57031|sonusEventTime : 1484582955|sonusSequenceEpoch : 41|hostID

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

You can add following on your Search Head

props.conf

[YourSourceType]
REPORT-getfields = extract_kv_pairs

transforms.conf

[extract_kv_pairs]
DELIMS = "|", ":"

Restart Splunk after making change.

View solution in original post

somesoni2
Revered Legend

You can add following on your Search Head

props.conf

[YourSourceType]
REPORT-getfields = extract_kv_pairs

transforms.conf

[extract_kv_pairs]
DELIMS = "|", ":"

Restart Splunk after making change.

jayakumar89
Explorer

@somesonie Thanks and it works. I would like to extract the first 5 fields and provide FIELD-NAME to them. how can i do that ?

0 Karma

somesoni2
Revered Legend

YOu need to setup field extraction in props.conf like this.

props.conf

 [YourSourceType]
 REPORT-getfields = extract_kv_pairs
 EXTRACT-firstfive = ^(?<fieldname1>[^\|]+)\|(?<fieldname2>[^\|]+)\|(?<fieldname3>[^\|]+)\|(?<fieldname4>[^\|]+)\|(?<fieldname5>[^\|]+)\|
0 Karma

jayakumar89
Explorer

It helped. Thanks.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...