Splunk Search

field extraction

msachdeva3
Explorer

I have a data in the format

index = abc earliest =-10d when i run get results in teh format of string
result set events
data: {"Ts":1485478049000,"Off":-6,"Term":"ABCD1234","Msg":"ABCDSDfaafafsomestring value","Ip":"someipnumber"}

I want to extract values of Termm,Msg, &ip value

I have tried using field extraction but having issues I want to get through regex or rex, Can you pls let me know how can i get values into fields like ip, Msg & Term

Thanks

0 Karma

gokadroid
Motivator

If its json then it shall already be extracted, but if not already extracted then you can extract them using below regex which will extract the values in fields called termField, msgField, ipField :

your query to return events
| rex field=_raw "Term\"\s*:\s*\"(?<termField>[^\"]+)\",\"Msg\"\s*:\s*\"(?<msgField>[^\"]+)\",\"Ip\"\s*:\s*\"(?<ipField>[^\"]+)\""
| table termField, msgField, ipField

You can change the names of these fields if you like by changing it in above regex and same regex can be used in field extractor.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...