Splunk Search

REST API Incomplete Results

vvvinamer
Engager

Getting incomplete (lesser number of events as results ) when using rest API. The same search i run in the splunk enterprise gives 90 events always, but the splunk api returning only 12-14 events(varying). Both the searches have earliest_time=-1d and the exec_mode is oneshot, so i am getting the results back then only.

Here i was using search/jobs api and oneshot mode, so the reuslts were incomplete. I read somewhere and rather used post:search/jobs, get: search/jobs/{sid} in a while loop and then retrieved results, but the results still are incomplete.

Cant  seem to find a solution, would be great if anyone could help, my search looks like this, although not sure if it matters.

index="val" [search index="val" field1="val2"   |  dedup  field2  |  format]  eventstats count by field2

Labels (2)
0 Karma

arjunpkishore5
Motivator

Try adding attribute count=0 to you rest query

 

https://<host>:<mPort>/services/search/jobs?sid=<sid>&count=0

 

 

0 Karma

vvvinamer
Engager

Screenshot (7).png

Thanks for replying but, tried adding that but no change, this time the actual search(a different search than my post) on splunk generated 147 events whereas splunk api got 62 events. Also my search is oneshot and i wasnt able to find the count field in search/jobs post methods. 

0 Karma

jkat54
SplunkTrust
SplunkTrust

are you adding earliest=-24h to your search in the UI or are you using the time picker to select last 24h?  

try explicitly adding it to your UI search to see if that makes a difference.

also, verify you are dispatching the REST search in the same app & user context.  Use servicesNS endpoints to do that. 

0 Karma

jkat54
SplunkTrust
SplunkTrust

Post the search to

 

 

https://<host>:<mPort>/servicesNS/userName/appName/search

 

  

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...