Dashboards & Visualizations

How to highlight dynamic timelines in Splunk?

SridharS
Path Finder

hey hi,

I am newbie to Splunk. I am trying to create a dashboard. I created the dashboard in a way that, if I give a group name, the servers which belongs to that particular group will get displayed along with their last response time(with the help of Community member). Now what I require is to highlight the servers which are not been reporting for past 7days. I google and made some reportime.js file and tried, but no luck. Is there any way that I can do it in splunk itself without going to a .js file??

Tags (2)
0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

You can't call the javascript/stylesheet like that. All js and css must reside in $APP_HOME/appserver/static. So put table_row_highlighting.js in that folder, and call it like this:

<form script="table_row_highlighting.js"> ....

Restart splunkweb once you have done this, and it should load the JS and execute.

0 Karma

bmacias84
Champion

Take a look at Splunk 6.x Dashboard Examples. It contain many example and has what you are trying to do.

0 Karma

SridharS
Path Finder

Yeah. I had a look 6.x dashboard on that and tried to do highlight using .js file. My query here is am not able to do it so with | Highlight... command. Is there any other way that I can get it done with splunk query itself instead of going to .js?

0 Karma

bmacias84
Champion

The closest thing you have is using the heatmap overlay option or rangemap command, however what you want can only be accomplished with js.

0 Karma

SridharS
Path Finder

Hi, I created a table_row_highlighting.js and decoration.css file and called it in my dashboard xml. But i find that this file is not effecting in my dashboard.

In the .js file i want to highlight the list of server that are not responding for past 48hrs(i.e. 2 days). I tested the script and called it in my .xml file, but no luck. Can you please find what error I am facing here. Here the 'host' and "Last" columns contains the server name and server's last response time. The .js is here

require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {

var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
    canRender: function(cell) {

        return _('List').contains(cell.field);
    },
    render: function($td, cell) {



        var currentDate = new Date();
       var prevDate = new prevDate(cell.value)


        if (cell.field === 'Last') {
            if(prevDate<currentDate) {
                $td.addClass('range-cell').addClass('range-elevated');
            }
        }

        $td.date(currentDate.toFixed(currentDate)).addClass('date');
    }
});
mvc.Components.get('highlight').getVisualization(function(tableView) {

    tableView.table.addCellRenderer(new CustomRangeRenderer());
    tableView.on('rendered', function() {

        tableView.$el.find('td.range-cell').each(function() {
            $(this).parents('tr').addClass(this.className);
        });
    });

    tableView.table.render();
});

});

And I called this script here in .xml file

0 Karma

SridharS
Path Finder

I called the .xmll in dashboard like this
form script="~/splunk/bin/table_row_highlighting.js" stylesheet="~/splunk/share/splunk/search_mrsparkle/exposed/css/decoration.css"

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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...