Dashboards & Visualizations

How to display indexed HTML content in Dashboard?

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi

I want to know how we can display indexed HTML content in Dashboard.

My sample dashboard xml is below. (Here I have used SAMPLE search which will return HTML content)

<dashboard>
  <search>
    <query>| stats count | eval A="<h1>My Test HTML</h1>" </query>
      <preview>
        <set token="A">$result.A$</set>
      </preview>
  </search>
  <label>Test Html</label>
  <row>
    <panel>
      <html> $A$ </html>
    </panel>
  </row>
</dashboard>

My Expected result is:

My Test HTML

So is it possible without using Javascript? I have tried with javascript and it's working. But we don't want to use Javascript.

Thanks in advance.

Kamlesh

Tags (1)
0 Karma

woodcock
Esteemed Legend

You can (1-way trip) convert your whole panel to html or you can add some html child elements in the XML but only in some nodes. For example, this is allowed in the panel node:

<panel>
  <!--title>Foo Bar</title-->
  <html>
    <div style="text-align: left;">
      <h2>Foo Bar</h2>
    </div>
  </html>

But this results in Invalid child="html" is not allowed in node="dashboard":

<dashboard>
      <html>
        <div style="text-align: left;">
          <h2>Foo Bar</h2>
        </div>
      </html>
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

HI woodcock,

I just given a sample xml.
Can you please see my comment on @cmerriman's comment??

Thanks
Kamlesh

0 Karma

cmerriman
Super Champion

does this get you what you need:

<dashboard>
   <search>
     <query>| stats count | eval A="My Test HTML" </query>
       <preview>
         <set token="A">$result.A$</set>
       </preview>
   </search>
   <label>Test Html</label>
   <row>
     <panel>
       <html> <h1>$A$</h1> </html>
     </panel>
   </row>
 </dashboard>

put the html formatting in the html panels? unless I'm missing something, which is completely possible

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @cmerriman,

Thanks for your reply.
Yes we can do this but my index contains the html pages.
My all html page get index in main index and HTMLContent filed has html tags. It Could be table , div or any tag.

Can you please guide me in this scenario.??

Thanks
Kamlesh

0 Karma

cmerriman
Super Champion

Just as a quick thought without testing anything, you could encase the query in CDATA. I'll try to test it out in a bit, bu let you might beat me to it.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @cmerriman,
I have tried with CDATA but no luck. It's showing HTML Decoded value.. like & gt;h1& lt;........

Thanks
Kamlesh

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 ...