Splunk Search

Can the exact same search return different results depending on use in a search bar versus the REST API?

couscousman
New Member

Hello,

this search in the search bar of splunk:

javaException=* earliest=-m@m | sort _time

returns about 100 results. My problem is, when I use splunk REST API, the exact same search does not return the same result. With:

curl -k -u user:pwd https://url:8089/services/search/jobs/export -d'search=search%20javaException%3D*%20earliest%3D-m%40m%20%7C%20sort%20_time'

I receive:

<?xml version='1.0' encoding='UTF-8'?>
<results preview='0'>
<meta>
<fieldOrder />
</meta>
<messages>
  <msg type="DEBUG">Configuration initialization took 48ms for /appsplunk/logiciels/list/splunk/etc</msg>
  <msg type="DEBUG">base lispy: [ AND ]</msg>
  <msg type="DEBUG">search context: user="user", app="search", bs-pathname="/appsplunk/logiciels/list/splunk/etc"</msg>
  <msg type="INFO">Your timerange was substituted based on your search string</msg>
</messages>

</results>

javaException is a field extraction at search-time.
I tried other GET requests which worked well like: * earliest=-m@m | sort _time.
So I believe the field extraction javaException is the cause of my problem, but I cannot figure out why.

Can I have some help, please ?

0 Karma

woodcock
Esteemed Legend

Is the "user" you are using in the "curl" command the same user as you are logged in when you run in the search bar? Is the Search Head where you are logged in running on the search bar the same Search Head that you are using in your curl? The answer to one of these questions is probably "no".

0 Karma

cpetterborg
SplunkTrust
SplunkTrust

Have you set up the user to have REST API access? Of not, you won't be able to get any data.

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...