Splunk Search
Highlighted

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

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
Highlighted

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

Community Manager
Community Manager

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?

Highlighted

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

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
Highlighted

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

Builder

Ok. Now I can see the question.

0 Karma
Highlighted

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

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
Highlighted

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

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