Splunk Search

How to extract a list of quoted key value pairs when some values have spaces?

prcough
New Member

Hello,

I am attempting to figure out how to extract the following example event for all fields (the real event has ~30 fields but these show all use cases).

{'start_time': '2019-07-30 15:19:20', 'duration': '2', 'ip': '192.168.1.1', 'mac': '00:00:00:00:00:00', 'source': 'open source'}

I started my attempts with delimiters I found through some googling,

transforms.conf
[my_sourcetype]
DELIMS = "\"{,}", ": "

With this in place the event would have duration and IP extracted, but not mac, source, or start_time.

Any help is appreciated.

0 Karma
1 Solution

jnudell_2
Builder

Hi @prcough ,

You're missing the command to allow multiple values:


transforms.conf
[my_sourcetype]
DELIMS = "\"{,}", ": "
MV_ADD = true

You could also try:


[my_sourcetype]
REGEX = '([^']+)': '([^']+)'
FORMAT = $1::$2
MV_ADD = true

View solution in original post

0 Karma

jnudell_2
Builder

Hi @prcough ,

You're missing the command to allow multiple values:


transforms.conf
[my_sourcetype]
DELIMS = "\"{,}", ": "
MV_ADD = true

You could also try:


[my_sourcetype]
REGEX = '([^']+)': '([^']+)'
FORMAT = $1::$2
MV_ADD = true

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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