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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...