Dashboards & Visualizations

Why is my "hello, world!" program not running after following instructions on http://dev.splunk.com/view/SP-CAAAERB?

shaoyongyang
Engager

I see the http://dev.splunk.com/view/SP-CAAAERB and already created a file path, but why is my "hello, world!" program not running?

C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\static\your_app_name\demoview.js
C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\templates\demoview.html

how can i do?

chimell
Motivator

Hi shaoyongyang

Enter manually this URL:

 http://localhost:8000/dj/your-djangoapp-name/demoview/

to find your "hello, world!" program

tell me if it satisfy you

0 Karma

vganjare
Builder

HI,

I followed same example, and was able to load the page successfully. I have created/modified following artifacts:

  1. demoview.js : No changes. Copied as it is from the example tutorial
  2. demoview.html : No Changes. Copied as it is from the example tutorial
  3. demoview.py : added as per "http://dev.splunk.com/view/SP-CAAAERA" tutorial. Please Note: update "your_app_name/demoview" with appropriate app name
  4. urls.py : Added entry url(r'^demoview/$', 'your_app_name.views.demoview', name='demoview'),
  5. views.py : @render_to('your_app_name:demoview.html') @login_required def demoview(request): return{ "message": "Hello World from your_app_name!", "app_name": "your_app_name", }

urls.py and views.py are present at : Splunk\etc\apps\your_app_name\django\your_app_name

Thanks!!

0 Karma

kvaga
Explorer

Hello!
What are you talking about python? Where did you find python files or snippets in the tutorial? Maybe I use incorrect URL of tutorial. Actually my question is: what I'm doing wrong?
My steps:

1) Created Application "customviewtutorial"
2) created dashboard with the following source code:

Custom View

<html>
  <div id="mycustomview"></div>
</html>

3) Created folders appserver/static under the $SPLUNK_HOME/etc/apps/customviewtutorial path.

4) Created customview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:

/* customview.js */

require([
    "/static/app/customviewtutorial/demoview.js",
    "splunkjs/mvc/simplexml/ready!"
], function(DemoView) {

    // Create a custom view
    var customView = new DemoView({
        id: "mycustomview",
        el: $("#mycustomview")
    }).render();

});

5) Created demoview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:

/* demoview.js */
define(function(require, exports, module){
    // Base class for custom views
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');
    // Define the custom view class
    var DemoView = SimpleSplunkView.extend({
        className: "demoview",
        // Override the render function to make the view do something
        // In this example: print to the page and to the console
        render: function() {
            // Print to the page
            this.$el.html("Hello, world!");
            // Print to the console
            console.log("Hello, world!");
            return this;
        }
    });
    return DemoView;
});

6) Restarted Splunk Instance
7) Trying to call http://localhost:8000/en-GB/app/customviewtutorial/custom_view but noting is hapened. My dashboard is empty.

Maybe my instance doesn't support javascript? How can I test it?
Help me please

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...