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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...