All Apps and Add-ons

How to format the HTML in automatic simple xml dashboard?

Sukisen1981
Champion

Hi,
I have a small question on simple xml html panels. Below is my code
<panel>
<html>
<div style="text-align: left;">
<h3>Duration</h3>
<div class="custom-result-value">$duration$</div>
</div>
<div style="text-align: center;">
<h3>Start Time</h3>
<div class="custom-result-value">$starttime$</div>
</div>
<div style="text-align: right;">
<h3>Result Rows</h3>
<div class="custom-result-value">$resultcount$</div>
</div>
</html>
</panel>

So what is happening is that duration.start time and result rows are picked from the token values. Now. the values are correctly coming aligned left,center and right as stated in the above code, however they are line breaks between them, please refer
alt text

I am not that good in HTML and need some help 🙂 🙂

0 Karma
1 Solution

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

View solution in original post

manish_singh_77
Builder

Hi Sukisen,

HTML table would be perfect fit for this case. We can use Css for style and alignment along with HTMl table for this requirement.

Find below the source code and let me know in case of any queries.

<dashboard>
  <label>Test</label>
     <row>
    <panel>
   <html>
     <style>
     #sla_table {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#sla_table td, #sla_table th {
    border: 1px solid #ddd;
    padding: 2px;
}

#sla_table th {
    padding-top: 2px;
    padding-bottom: 2px;
    text-align: left;
    background-color: #C0C0C0;
    color: black;
}

</style>
    <table id = "sla_table">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
     </tr>
  <tr>
    <td>$duration$</td>
    <td>$starttime$</td>
    <td>$resultcount$</td>
      </tr>
  </table>
  </html>
  </panel>
  </row>
</dashboard>

Sukisen1981
Champion

Hi @manish_singh_777 thanks for your detailed answer, the answer provided by @poete works and I have accepted it, nevertheless many thanks for your detailed reply 🙂

0 Karma

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

Sukisen1981
Champion

Gratefully accepted and I can understand the issue as well. I am sorry, I know this is a simple issue but I honestly did not have time to explore stuff, given my limited HTML knowledge. Thanks again

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!

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...

Share Your Feedback: On Admin Config Service (ACS)!

Help Us Build a Better Admin Config Service Experience (ACS)   We Want Your Feedback on Admin Config Service ...

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...