Splunk Search

How to change font size of texts inside table using dashboard xml source

ggangwar
Path Finder

Hi,
I have a splunk dashboard with different panels i.e. pie chart, table etc.
I need to increase the font size of text inside the table. Can anyone please help in this?
Is there a way to modify the source xml of dashboard to achieve this?

Just to add,I am using shared splunk server where multiple application's logs are forwarded so I do not have admin access of Splunk.

Tags (2)
1 Solution

niketnilay
Legend

@ggangwar, add the following code to your existing dashboard's Simple XML Code, it changes the font size in all tables

  <row depends="$alwaysHideCSSPanel$">
    <panel>
      <html>
        <style>
          table tbody tr td{
            font-size:150% !important;
          }
        </style>
      </html>
    </panel>
  </row>

Refer to one of my older answers for your options to apply CSS to your dashboard: https://answers.splunk.com/answers/590387/how-do-i-update-panel-color-in-splunk-using-css-1.html

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

View solution in original post

niketnilay
Legend

@ggangwar, add the following code to your existing dashboard's Simple XML Code, it changes the font size in all tables

  <row depends="$alwaysHideCSSPanel$">
    <panel>
      <html>
        <style>
          table tbody tr td{
            font-size:150% !important;
          }
        </style>
      </html>
    </panel>
  </row>

Refer to one of my older answers for your options to apply CSS to your dashboard: https://answers.splunk.com/answers/590387/how-do-i-update-panel-color-in-splunk-using-css-1.html

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

View solution in original post

ggangwar
Path Finder

@niketnilay Somehow, the pdf generated out of this dashboard is not having effect of applied css.
Can you please suggest what can I do for this?

0 Karma

niketnilay
Legend

@ggangwar PDF renderer in Splunk has a lot of limitations and does not play well with customization in dashboard. So your option would be to Print PDF manually and export.

May be if it is run on a dumb terminal use a utility code to take a snapshot at regular interval and email. (All this outside of Splunk).

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

ggangwar
Path Finder

If this is the case, Splunk product needs improvement in order to have this feature. From User's perspective, it is inconsistent behavior in terms of what is visible in Dashboard and what is actually added in PDF.

0 Karma

niketnilay
Legend

@ggangwar as far as I know this behavior has always been there. So I agree that PDF export needs complete revamp. If you have Splunk Entitlement you should reach out to Splunk Support with the enhancement request!

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

ggangwar
Path Finder

Thanks It helped. 🙂
I did not include depends field inside row. Using this was causing my table to disappear. Hence, , I rather put it under panel:

 <row>
    <panel depends="$alwaysHideCSSPanel$">
      <html>
         <style>
           table thead tr th,td{
           font-size:150% !important;
           width:150px !important;
           border: 1px solid black !important;
           text-align: right !important
           }
           table thead tr th{
            font-weight: bold !important;
           }
         </style>
       </html>
    </panel>
    <panel>
      <table>....
           ...
    </panel>
  </row>

vvemula
Path Finder

Thank you. It worked for me. 

0 Karma

ggangwar
Path Finder

And, if I want to increase the font of table header as well? Then can it be done as follows?:
table tbody tr th{
font-size:150% !important;
}

0 Karma

niketnilay
Legend

@ggangwar, almost there... Following is what you should use.

table thead tr th{
font-size:150% !important;
}

My answer link attached above also tells you how to use Browser Inspector tool to find the CSS Selector for specific node to apply CSS Override. Do up vote if you find it useful!

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
.conf21 CFS Extended through 5/20!

Don't miss your chance
to share your Splunk
wisdom in-person or
virtually at .conf21!

Call for Speakers has
been extended through
Thursday, 5/20!