Reporting

How to add a Splunk Report (saved search) inside the HTML tags?

saulcruzmendez
Explorer

I have created inside an HTML tag a popup with the modal class.
However, I'm interested in showing a Report (saved search) on that popup.
I'm not sure how to add such a report inside the HTML tag.

        <div class="modal popup-body $tokShowModel$" id="myModal">
         <div class="modal-header popup-header">
            <h3>Show a report</h3>
            <div>
             <a id="anchorCloseModalWindow" class="btn btn-primary btn-position">x</a>
            </div>
         </div>
         <div class="modal-body">
         <h1>Report comes here<h1>
         </div>
        </div>
0 Karma
1 Solution

niketn
Legend

@saulcruzmendez Go ahead and accept your own answer posted above. The reason why I had suggested Embedded Dashboards was to keep the complexity lower. However, if you are comfortable with Simple XML Extensions, you can try the following Splunk .Conf session by @jconger where Example 10 deals with Event Handler + Token + Table Cell Render + Modal + Splunk Web Framework to generate a chart as Modal pop-up exactly the same way as your requirement.

10 Tips, Tricks and Hacks for Better Dashboards in Splunk

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

saulcruzmendez
Explorer

@niketnilay Thank you for the link! I'll for sure watch the video session. I appreciate the help!

0 Karma

saulcruzmendez
Explorer

I was able to solve this via a Javascript, using a SearchManager and TableElement.

These links are pretty good documented:

https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_searchmanager.html
https://dev.splunk.com/enterprise/docs/developapps/webframework/displaydataview/howtoaddvisualhtml

saulcruzmendez
Explorer

@niketnilay

Thanks you for your answer. That could work but I need it to be a search on real time, not a schedule report. I have been looking around, and from what is looks like. I need to work on the modal window via JavaScript.

niketn
Legend

@saulcruzmendez, one simple approach would be to convert your saved search to scheduled search and enable Embedded Report (learn about the best practices to enable this).

https://docs.splunk.com/Documentation/Splunk/latest/Report/Embedscheduledreports

alt text

Then you can add the iframe code to your existing Modal Pop-up. Here is a sample code:

  <row>
    <panel>
      <html>
        <div class="modal popup-body $tokShowModel$" id="myModal">
          <div class="modal-header popup-header">
            <h3>Show a report</h3>
            <div>
              <a id="anchorCloseModalWindow" class="btn btn-primary btn-position">x</a>
            </div>
          </div>
          <div class="modal-body">
            <h1>Splunkd Error embedded as modal pop-up</h1>
            <div>
              <iframe height="400" width="480" frameborder="0" src="embedded_report_rest_uri_generated_after_converting_your_report_to_embedded_report"></iframe>
            </div>
          </div>
        </div>
      </html>
    </panel>
  </row>

Do try out and confirm.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...