Splunk Search

Why am I getting "no results found" trying to display a pie chart with my current code?

edrivera3
Builder

Hi

I am trying to display a pie chart in a Splunk app using the below code, but I received the message: no results are found. I already tested the search in the Splunk App and it worked correctly. I don't know what I am doing wrong. I appreciate your help.

<div class="dashboard-row">
<div class="dashboard-cell" style="width: 30%;">
    <div class="dashboard-panel">
    <div class="dashboard-element">
        <div class="panel-head">
        <h3> Top 10 Error Numbers since Jan 2015 </h3>
        <div class="panel-body">
            <div id="pie_Top_Err"></div>
        </div>
        </div>
    </div>
    </div>
</div>


</div>

var deps = [
        "splunkjs/ready!",
        "splunkjs/mvc/searchmanager",
        "splunkjs/mvc/chartview",
    ];
    require(deps, function(mvc) {
        // Load individual components
        var SearchManager = require("splunkjs/mvc/searchmanager");
        var ChartView = require("splunkjs/mvc/chartview");

// Pie Chart (Top Error Numbers) 
var Top_Err = new SearchManager({
        id: "Top_Err",
        preview: true,
        cache: true,
        status_buckets: 1000,
    search: 'index=mod_jobevent earliest="1/1/2015:00:00:00" latest="5/23/2015:00:00:00" | rex "(?<error_block>ERROR_[\w\W\n]+)" | rex field=error_block "ERROR_:(?<error_num>\d+)"   | rename error_num as "Error Number" | stats count by "Error Number" '
    });

var pie_Top_Err = new ChartView({
    id: "pie_Top_Err",
    managerid: "Top_Err",
    type: "pie",
    el: $("#pie_Top_Err")
}).render();
});
0 Karma
1 Solution

edrivera3
Builder

Hi

I found what my problem was. I forgot to escape every &#92, <, and > in my search.

View solution in original post

0 Karma

edrivera3
Builder

Hi

I found what my problem was. I forgot to escape every &#92, <, and > in my search.

0 Karma

ppablo
Retired

Hi @edrivera3

Can you please provide more details on exactly what your question/issue is? What is currently the problem? What are you expected as the desired result?

edrivera3
Builder

Hi ppablo. Sorry I didn't want to publish the question yet. I just edited it, but I don't know why I can't see the question anymore.

0 Karma

edrivera3
Builder

Ok. Now I can see the question.

0 Karma

pradeepkumarg
Influencer

Can you go to activity -> jobs and see what search exactly has fired from your dashboard? That will give you a clue if you had any issues in your search. You can also click on inspect from there and see if the search reported any errors

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...