Knowledge Management

Triggering searches

SplnkUse
Path Finder

Hello,

 

I am still trying to figure out the framework of how things work (please note I am not admin).

 

There is a dashboard which has some radio buttons which trigger specific searches and the results are displayed in the dashboard.

 

I want to trigger these searches ad hoc in the Search webpage. So I need to:

  1. Get a search alias/link/id for each of the searches in the dashboard
  2. Use these aliases to trigger the same search manually

 

I would prefer to use a REST API command directly in my PowerBI, is that possible?

If not, I would still prefer to use a REST API command in the Search webpage

 

Unfortunately, the following does not work for me:

| rest /services/data/ui/views/

 

But this works:

| rest splunk_server=local servicesNS/-/-/data/ui/views/

 

Can you help me with the right code please?

 

Thanks!

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Not all dashboards have links to their searches (IME, most do not).  Instead, the searches are inline.

To replicate a dashboard using the API, you'd have to use the data/ui/views call to get the eai:data field.  Then you'll need to parse that field to extract the <input> elements (so you know what the inputs are) and the <panel> elements.  Each will contain a <search>, which may be an in-line search or may invoke a savedsearch using either the loadjob or savedsearch command.

The <input> elements will define one or more tokens.  Any search that uses a token will not run until that token is defined.  This is the "trigger" you've noticed.  Your code will have to get the proper input from the user so it can set the tokens needed by the searches.

Once the tokens are defined, you can fill in the missing parts of the searches and use the REST API to invoke them.  The API will return a search ID, which you will use to periodically poll Splunk to see if the search has completed or not.  Once the search is complete, you can use another API call to retrieve the results.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Not all dashboards have links to their searches (IME, most do not).  Instead, the searches are inline.

To replicate a dashboard using the API, you'd have to use the data/ui/views call to get the eai:data field.  Then you'll need to parse that field to extract the <input> elements (so you know what the inputs are) and the <panel> elements.  Each will contain a <search>, which may be an in-line search or may invoke a savedsearch using either the loadjob or savedsearch command.

The <input> elements will define one or more tokens.  Any search that uses a token will not run until that token is defined.  This is the "trigger" you've noticed.  Your code will have to get the proper input from the user so it can set the tokens needed by the searches.

Once the tokens are defined, you can fill in the missing parts of the searches and use the REST API to invoke them.  The API will return a search ID, which you will use to periodically poll Splunk to see if the search has completed or not.  Once the search is complete, you can use another API call to retrieve the results.

---
If this reply helps you, Karma would be appreciated.
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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...