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
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...