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 (1)
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. 

jkat54
SplunkTrust
SplunkTrust

Post the search to

 

 

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

 

  

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...