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!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...