Splunk Search

Splunk extract exact match for a customer name

balash1979
Path Finder

Here is my splunk log line

{"line":"2019-08-15T17:48:28.935Z LCS {\"configName\":\"Apple-SQS\",\"customerName\":\"Apple\"} INFO  i.r.p.s.Processor - finished processing}

When I search , I am trying the following

index=docker_logs_index  | search "Apple"

My search is catching Apple because Apple is part of configName but I only want to see results if customerName is Apple.
How can I modify my splunk query to accomplish that.

Tags (1)
0 Karma
1 Solution

mayurr98
Super Champion

Try this:

 .. | rex "customerName\\\\\":\\\\\"(?<customerName>[^\\\]+)" | search customerName="Apple"

OR

  | rex "customerName\\\\\":\\\\\"(?<customerName>\w+)" | search customerName="Apple"

View solution in original post

0 Karma

Sukisen1981
Champion

try this

 index=docker_logs_index | rex field=_raw "customerName\\\+\"+\:+\\\+\"(?<custname>.*?)\\\+\"" | where custname="Apple"
0 Karma

mayurr98
Super Champion

Try this:

 .. | rex "customerName\\\\\":\\\\\"(?<customerName>[^\\\]+)" | search customerName="Apple"

OR

  | rex "customerName\\\\\":\\\\\"(?<customerName>\w+)" | search customerName="Apple"
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 ...