Splunk Search

Dashboard-Data and search as one query

nithys
Communicator

Hi Team,

Currently in my dashboard i am using two separate query for data and search lambda separetly and added to the dashboard
1.I want a combine query which works for both data and search lambda together an display reult as below

GET /data/v1/amaz1601
GET /search/v1/amaz159
GET /data/v1/product3
GET /search/v1/product186
GET /data/v1/hack373
GET /data/v1/cb11127
GET /search/v1/hack297

 




Data lambda query:

index=np    source IN ("/aws/lambda/p-api-data-test-*") "gemini:streaming:info:*:*:responseTime"
| eval Entity = requestType . "/data/" . entity
| stats 
    sum(responseTime) as totalResponseTime,
    avg(responseTime) as avgResponseTime,
    count as totalTimeBuckets
    by Entity
| eval avgResponseTime = round(avgResponseTime, 2)
| rename totalResponseTime as "totalResponseTime(ms)", avgResponseTime as "avgResponseTime(ms)", totalTimeBuckets as "totalTimeBuckets"
| table Entity "avgResponseTime(ms)" 
| sort - "totalResponseTime(ms)"

Data lambda Event:

{ [-]
   apiResponseTime: 222
   awsRequestId: 
   client: Joshu
   domain: product
   entity: product
   hostname: 
   level: 30
   msg: gemini:streaming:info:product:data:responseTime
  
   pid: 8
   queryParams: { [+]
   }
   requestType: GET
   responseTime: 285
   time: 2025-05-01T21:59:06.588Z
   v: 0
}


Search lambda:

index=np  source="/aws/lambda/p-api-search-test-*" "gemini:streaming:info:*:search:response:time"
| rex field=source "/aws/lambda/pdp-pc-api-search-test-(?<entity>[^/]+)"
| eval Entity = requestType . " search/" . entity
| stats 
    sum(responseTime) as totalResponseTime,
    avg(responseTime) as avgResponseTime,
    count as totalTimeBuckets
    by Entity
| eval avgResponseTime = round(avgResponseTime, 2)
| rename totalResponseTime as "totalResponseTime(ms)", avgResponseTime as "avgResponseTime(ms)", totalTimeBuckets as "totalTimeBuckets"
| table Entity  "avgResponseTime(ms)" 
| sort - "totalResponseTime(ms)"

Search lambda Event:

{ [-]
   apiResponseTime: 146
   client: Joshua.Be
   domain: product
   entity: amaz

   level: 30
   msg: gemini:streaming:info:amaz:search:response:time
 
   pid: 8
   queryHits: 50
   queryParams: { [+]
   }
   requestType: GET
   responseTime: 149056
   time: 2025-05-01T22:01:35.622Z
   v: 0
}

2.Data api msg: will be: gemini:streaming:info:product:data:responseTime
Search api msg: will be: gemini:streaming:info:amaz:search:responseTime
so in query i added keyword as "gemini:streaming:info:*:*:responseTime" but througing error as 
"The term '"gemini:streaming:info:*:*:responseTime"' contains a wildcard in the middle of a word or string. This might cause inconsistent results if the characters that the wildcard represents include punctuation"

 

Screenshot 2025-05-01 at 2.58.14 PM.png

Labels (1)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @nithys 

As @bowesmana mentioned - since you dont have many variances then you should specifically list them in an "IN" within your search.

Then do any evals to align your different events, such as using COALESCE to map different field names into a common fieldname (e.g | eval responseTime=COALESCE(responseTime, response_time))

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Why are you using wildcards if they are not necessary. Your data and your comments say the msg values are defined as 

gemini:streaming:info:product:data:responseTime
gemini:streaming:info:amaz:search:response:time

(The data shows a slight difference in responseTime vs. response:time compared to your comment)

Just use this type of search

... msg IN ("gemini:streaming:info:product:data:responseTime","gemini:streaming:info:amaz:search:response:time")
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...