Dashboards & Visualizations

How do I add ICONS to a table in a Splunk dashboard?

darshana2511
New Member

I refered the example of Table Icon Set (Inline). But I do not have count function in my Query. I am attaching my query below.

index="ad_dns_new" sourcetype="resolve_json"|eval k=strptime(DateTime,"%Y-%m-%dT%H:%M:%S")|eval New_Date=strftime(k,"%d-%m-%Y") | table HealthCheck,Result,New_Date,Customer|chart values(Result) as Result over HealthCheck by New_Date

and I need Icons if result value is PASS then icon = 'check-circle' and if result value is Fail then icon='alert-circle'.

What changes do I need in my JavaScript file? I already made some changes, but it is not working. Please help me as I am new to Splunk.

0 Karma

darshana2511
New Member

I want to know what can I use instead of rangemap. as I do not have count function in my query.

0 Karma

darshana2511
New Member

Do you have any idea how to do it?

0 Karma

niketn
Legend

@darshana2511, what changes have you done in your JavaScript file? If possible please share code snippet for the changes (Mock/anonymize any sensitive information).

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

darshana2511
New Member

what should I use instead of rangemap in my query? as I do not have count function in my query.

0 Karma

darshana2511
New Member
var CustomIconRenderer = TableView.BaseCellRenderer.extend({
    canRender: function(cell) {
        return cell.field === 'Result';
    },
    render: function($td, cell) {
        var Result = cell.value;

        // Compute the icon base on the field value
        var icon;
        if(Result == "Fail") {
            icon = 'alert-circle';
        } else if(Result == "PASS") {
            icon = 'check';
        } else {
            icon = 'alert';
        }

        // Create the icon element and add it to the table cell
        $td.addClass('icon-inline numeric').html(_.template('<%- text %> <i class="icon-<%-icon%>"></i>', {
            icon: icon,
            text: cell.value
        }));
    }
});

mvc.Components.get('table1').getVisualization(function(tableView){
    // Register custom cell renderer, the table will re-render automatically
    tableView.addCellRenderer(new CustomIconRenderer());
});

});

0 Karma

msivill_splunk
Splunk Employee
Splunk Employee

This blog post should provide some pointers for you https://www.splunk.com/blog/2014/03/17/custom-icons-in-splunk-6-tables.html

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...