Splunk Search

Splunk Field Extraction inside a bracket

jadengoho
Builder

Hi All,
Is there any faster way to extract fields with this format on props and transforms file? like Key value pair ?
There's a lot more field than that , that's why im finding an easier way to extract field value

2020/03/01-10:01:01 [firstname "JOHN"] [surename "DOE"] [age "30"] [state "NY"] [id "10001"]
2020/03/01-10:01:02 [firstname "Julie"] [age "58"] [state "AU"] [id "10002"]
2020/03/01-10:01:02 [firstname "MEGAN"][middlename "myra"] [surename "DOE"] [age "58"] [state "AU"] [id "10052"]
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

REGEX = \[(?<key>\S+)\s+"(?<value>[^"]+)
FORMAT = $1::$2

See here:
https://regex101.com/r/ZvxlMY/1

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

REGEX = \[(?<key>\S+)\s+"(?<value>[^"]+)
FORMAT = $1::$2

See here:
https://regex101.com/r/ZvxlMY/1

0 Karma

jadengoho
Builder

thanks @woodcock - this is very helpful.
Can i use this command for specific logs only ? i need this configuration for INFO only not DEBUG?
https://regex101.com/r/ZvxlMY/2

 2020/03/01-10:01:01 INFO [firstname "JOHN"] [surename "DOE"] [age "30"] [state "NY"] [id "10001"]
 2020/03/01-10:01:02 DEBUG [firstname "Julie"] [age "58"] [state "AU"] [id "10002"]
 2020/03/01-10:01:02 INFO [firstname "MEGAN"][middlename "myra"] [surename "DOE"] [age "58"] [state "AU"] [id "10052"]
0 Karma

woodcock
Esteemed Legend

There is no sense in limiting the field extraction. Limit it in your search. Create your stanza based on sourcetype.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Faster than what? Easier than what? What are your current props.conf settings?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...