Splunk Search

Field extraction on a delimited file

rubinod
Engager

Hi,

I would like to assign fields to a delimited text file which does not contain a header.

Lets say an event or row of data looks like the following for a given source:

2343242| 234234cvf32:2345:5656556:-2000|abc-1|DOP|selected|list|{"anid":0,"vid":0,"name":"aname"}|04-03-2013|xyz

As you can see one of the values in the pipe delimited row is JSON, I would like to be able to refer to this data as a specific field and parse it as JSON.

What would be the best approach for this in Splunk?

Regards
D

Tags (1)

kristian_kolb
Ultra Champion

This can be done I believe with the use of TRANSFORMS

First look at the REPORT directive from props.conf, which maps to a stanza in transforms.conf.

props.conf

[your sourcetype]
REPORT-blah = delim_split, json_split

transforms.conf

[delim_split]
DELIMS = "|{}"
FIELDS = your list of fields, one of them will contain the JSON string

[json_split]
DELIMS = ",",":"

Something like that should work. Sort of. Look at the docs.

/K

/K

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

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 ...