Splunk Search

How to extract multi key value from a single event

shaal89
New Member

Here is the logs,

event=SUCCESS_FROM_SERVICE UserID=abc currentTime=2017-03-31T05:22:52.176Z headline="[{'contentUUID':'10a1f2a2-1489-11e7-b0c1-37e417ee6c76','title':'South Africa's Zuma embarks on a game of chicken with markets'},{'contentUUID':'6961129e-14fa-11e7-80f4-13e067d5072c','title':'Race for speed among algo traders hits peak'}]"

I am able to extract the values of first 'contentUUID' and first 'title' by the search command below whereas I'm unable to get the 2nd set of values. The search I'm adding is,

search index=heroku sourcetype=heroku:drain source=/var/log/apps/heroku/cont-acc-tkn-ui.log event=SUCCESS_FROM_SERVICE | rex max_match=10 field=_raw "'contentUUID':'(?P[^']+)" | rex max_match=10 field=_raw "'title':'(?P

Tags (1)
0 Karma

somesoni2
SplunkTrust
SplunkTrust

You would be getting a multivalued fields. Are you sure you're not able to extract second set? Do you see both values if your add | table contentUUID title at the end of your current search.

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Try this

| rex max_match=10 field=_raw "\'title\':\'(?P<mytitle>[^\}]*)\'(?=\})"
0 Karma

DalJeanis
SplunkTrust
SplunkTrust

Please remember to mark your code with the code button (101 010) so that the html-like tags won't be treated as formatting by the web interface.

0 Karma
Get Updates on the Splunk Community!

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

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...