Dashboards & Visualizations

Can you help me with my rex search which is returning null values?

bizsplunk
Engager

hi all,

Please help with my search result which returns null value when I use it in my view. Search results inside a Splunk return required data, nevertheless.

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    '/static/app/mastering/visview.js',
    'splunkjs/mvc/searchmanager',
    'splunkjs/mvc/simplexml/ready!'],
function(_, $, mvc, VisView, SearchManager, ){

    //vis search
    var mySearch1 = new SearchManager({
        id: "mysearch1",
        preview: true,
        cache: true,
        search: "| inputlookup earthquakes.csv | rex field=Datetime \"^.*,\s(?<me>[^_]*\d)\" | table me | head 1",

    });
    var customView = new VisView({
        id: "mycustomview",
        managerid: "mysearch1",
        el: $("#vis1"),
    }).render();
});

and view is :

define(function(require, exports, module){
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');

    var VisView = SimpleSplunkView.extend({
        className: "visview",
        options: {
            data: "results"
        },
        formatData: function(data) {
            console.log(data);
            return this; 
        },
        createView: function(){
            return this;
        },
        updateView: function(viz, data) {
            var myResults = data[0];
            this.$el.html("The count of search results: <b>" + myResults + "</b>");
        }
    });
    return VisView;
});
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@bizsplunk

can you please share sample data from lookup file?

0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @bizsplunk

Did the answer below solve your problem? If so, please resolve this post by approving it!
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

Vijeta
Influencer

Try replacing < by &lt; and > by &gt; in your XML

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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