Splunk Dev

Menu bar is is not visible when using django framework example

tomschoute
Explorer

I am following example: 1. Create an app and add a page template from the django tutorial on the splunk site to create an app.

I've created my app but if I go there there is no top splunk navigation bar (after the splunk> the "app menu - Administrator - Messages - Settings - activity - Help" are all not shown)
Also the Home and app name are not visible in the grey area just below the black top splunk menu (on the page1.html page that I created following the instructions on above mentioned page).
What is causing this? What do I miss?

Only difference I can see so far is that I have a slightly different URL in my splunk: there is a /en-us/ in my URL which is not in the one which is used on the splunk example page.

Can anyone please help me out here? I'm trying to evaluate if a splunk app might be something which is of interest for my customers. But I get stuck on the first step...

Tags (2)
0 Karma

jeffland
SplunkTrust
SplunkTrust

Which base template did you use? There are templates without the app bar.

See here for where to do it (it's the second line, {% extends "splunkdj:" %}, and here for the options you have.

tomschoute
Explorer

I use the app one. See my simple html file below that I'm trying to use:

{% extends "splunkdj:base_with_app_bar.html" %}

{% load splunkmvc %}

{% block title %}{{app_name}} Servicecall Performance{% endblock title %}

{% block css %}
<!-- Style sheets are loaded here -->
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}{{app_name}}/custom.css" />
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}splunkjs/css/dashboard.css" />
<style>
/* Define any page styles here*/
</style>
{% endblock css %}

{% block content %}
<!-- You can use HTML and <div> tags for layout -->
{# Splunk views go here #}
<div>
<div class="main-area">
<p>This page gives an overview of the Servicecall metrics</p>
</div>
</div>
{% endblock content%}

{% block managers %}
{# Search managers go here #}
{% endblock managers %}

{% block js %}
{# JavaScript goes here #}
{% endblock js %}

0 Karma

jeffland
SplunkTrust
SplunkTrust

Hm, that looks ok to me.

But you said you wanted to create an app, and for that you do not need to use the django templates at all. You could (while in the search app) simply click top left Apps -> Manage Apps, and on that page where it shows you the installed apps use the button "Create App" to create an app via the web ui. That way, you can comfortably set any early settings, and even select to have your app use a basic template (so you start your app with a pre-made page instead of an empty app).

0 Karma

tomschoute
Explorer

Ok thanks, I did not see that yet.
I've created an app with that but how can I now modify the app. Add pages to it etc.?

0 Karma

jeffland
SplunkTrust
SplunkTrust

That is actually entirely up to you, there are a few ways to do it. You could write entire pages in html and reference them from the main navigation, or you can create the dashboards for the app by starting from a search and saving that search as a dashboard. If you have any, you could also use reports to reference in the dashboards. You can also directly edit the XML underlying a dashboard that's not written in html, or edit dashboards with the web ui editor.
Creating apps is more than dashboards though, an app contains knowledge objects as well. All in all, apps are quite powerful and essential elements. It takes time to master the required techniques (it is not something you do overnight), but you can get started pretty easily with editing some dashboards with the web ui editor while observing the changes to the underlying XML, and from there you'll learn by doing.
For a guided start, you could for example go here and follow the steps under "Building your first App".

0 Karma

tomschoute
Explorer

Thanks again.
I understand that it takes some time to master all this. I have a technical background so I hope I can manage 😉
Thanks for the link as well. I will check that.
One question though: how can I add django in here? Or is everything doable with this UI?
I liked some of the examples they gave, i.e. for showing a config form at first startup that sort of things.
Next to that I like it better to modify file and understand the dir structure than going through a UI.
If you have any more helpful links to build apps (with or without django) than I would appriciate it a lot.

0 Karma

jeffland
SplunkTrust
SplunkTrust

To be honest, I quickly abandoned django tags; they may make some things easier for beginners but they also add another layer which I personally don't feel I need because I can do everything just fine without them. When I work with apps, I use XML/the web ui for the layout, CSS for advanced layout, and Javascript for any additional functionality. I still need to know the foder layout and edit files directly - have a look at this nice document for more on that topic.

My recommendation to learn about app creation is to generally follow the ideas from the previous link, and also to download the Splunk 6.x dashboard examples app to have a look at how things can be done.

And of course, feel free to ask any specific questions here 🙂 I'm sorry I couldn't help you with your initial question above so far, you'll eventually be able to find out yourself. There is a lot that could cause this, from splunk user roles/capabilities to filesystem permissions and typos in any place of your code, and much more.
You could, for example, also try to go to the last page of the tutorial you were trying to do and see if they have the complete code ready for you to see if you can get that to work.

0 Karma

tomschoute
Explorer

Thanks so much for your help. This gives me some pointers I can proceed with.

0 Karma

stephanefotso
Motivator

Look very well . If you have created your app properly, and add a page template, by following the link : http://localhost:8000/dj/yourdjangoappname/yourpagename, you must see at the top after the splunk> the "app menu - Administrator - Messages - Settings - activity - Help something like this

alt text

SGF
0 Karma

tomschoute
Explorer

Stephanefotso,
I've looked very well and I can assure you, there is no menu to be seen after splunk>!

What can I do wrong when creating the app? I've used the command "splunkdj createapp mydjangoapp" as an administrator. The app is created and placed in the list of apps in splunk but the menu is not visible, nor is the app title.

Tom

0 Karma

stephanefotso
Motivator

Did you restart Splunk? if not follow step by step the instructions to create your app using django binding here:

http://dev.splunk.com/view/SP-CAAAEMS

SGF
0 Karma

tomschoute
Explorer

Several times.
Compared to your pic I only see the "splunk>" text, all the rest is not there, also not the footer.

0 Karma

stephanefotso
Motivator

ok follow the link http://dev.splunk.com/view/SP-CAAAEMS and try again.

SGF
0 Karma

tomschoute
Explorer

That is exactly what I did before...
Tried it again, created another app, restarted splunk. Result is still the same, no menu's and footer.

Can there be anything in my environment that is causing this? I use splunk free on a windows 8.1 pc.

0 Karma

stephanefotso
Motivator

No. the problem is not splunk free. i faced a similar problem with my windowd 8 some time. But i'm now working with linux and it is working . ok what you can do now is to give permissions to your splunk folder and test again. Right click on the splunk folder--properties --Secutity ......

SGF
0 Karma

tomschoute
Explorer

Alas, that did not work either.
I changed security for users (admin already had all rights and I am logged in as a user who is member of the admin group). Restarted splunk: no change.
Created a new app - restarted splunk. This new app also doesn't have menu and footer.

This is driving me nuts! If it is this hard to get the simplest app working, what if I need some more complex things?

0 Karma

vganjare
Builder

Hi,

The app bar is loaded by AJAX calls. Can you please check if any JS error is coming? This can be tested in Chrome - console tab.

0 Karma

tomschoute
Explorer

I see this:
Refused to execute script from 'http://localhost:8000/dj/static/js/build/splunkjs.min/config.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
localhost/:104 Uncaught ReferenceError: require is not defined
localhost/:114 Uncaught ReferenceError: require is not defined

0 Karma

tomschoute
Explorer

Does anyone have an idea if and how I can solve this?

0 Karma

vganjare
Builder

Can you please share the server.conf settings for stanza [httpServer]? server.conf can be found @ splunk/etc/system/default folder.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...