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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...