Splunk Search

using custom JS rendering scripts

yong_ly
Path Finder

I'm having a bit of a problem with using JS scripts in my dashboard panels. I've been using the Simple XML examples and they work great. For example the table_row_highlighting.js file is great but it only works for one table where as I would like to have it for multiple tables.

I figured I could just copy it into a file nagios_highlight.js and change the table ID and it would work fine but that doesn't seem to be the case.

I've placed in the $SPLUNK_HOME/etc/apps/myapp/appserver/static folder, added the script name to my dashboard xml, added the new id to a different table and restarted the splunk instance but it's not working. Am I putting it in the wrong place or do I need to register the js file somewhere else??

<dashboard script="nagios_highlight.js" stylesheet="application.css">
...
  <row>
    <table id="nagios_highlight">
      <title>Status Dashboard</title>
      <searchString>sourcetype=nagios_status servicestatus | sort by _time DESC | dedup host_name, service_description | eval last_check=strftime(last_check,"%d/%m/%y %H:%M:%S") | eval event_duration=tostring(now()-last_state_change,"duration") | rename problem_has_been_acknowledged as acknowledged |  table _time, host_name, service_description, plugin_output, current_state, last_check, event_duration, acknowledged</searchString>
      <earliestTime>-10m</earliestTime>
      <latestTime>now</latestTime>
      <option name="wrap">true</option>
      <option name="rowNumbers">false</option>
      <option name="dataOverlayMode">none</option>
      <option name="drilldown">row</option>
      <option name="count">50</option>
    </table>
  </row>
...

I can't seem to figure this one out. From the page source it seems to load the .js file but the rows don't get highlighted.. any ideas?

Tags (2)
0 Karma
1 Solution

yong_ly
Path Finder

Just in case anyone was wondering it was my lack of CSS knowledge that was the problem. Once I defined additional selector IDs to match the table IDs it worked fine.

View solution in original post

0 Karma

yong_ly
Path Finder

Just in case anyone was wondering it was my lack of CSS knowledge that was the problem. Once I defined additional selector IDs to match the table IDs it worked fine.

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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...