Dashboards & Visualizations

Unauthenticated dashboard

Champion

Hello,

I don’t know about you, but every so often I get the request for a dashboard that does not require a user to authenticate and/or timeout. Prior to 6.x the time out issue could be solved using jscript. Still execs/management do not like to login (It should be like magic doesn’t the system know who I am! Joking just a little). Has anyone found a solution to this yet.

1 Solution

Champion

The easiest way I found was to build django app. where I did not want users to authenticate I created a new view in view.py and remove the @login_required decorator rendered it to a template. I realized this that Splunk use the django framework and should I bide by the same rule and conventions.

  1. Create your django app
  2. Create a template <yourtemplate>.html in $SPLUNK_HOME/<yourapp>/django/<yourapp>/template/
  3. New create a new function in views.py located $SPLUNK_HOME/<yourapp>/django/<yourapp>/


    # Before
    @render_to('<yourapp>: <yourtemplate>.html')
    @login_required
    def <yourtemplate> (request):
    return {
    "message": "Hello World from <yourapp>!",
    "app_name": "<yourapp> :"
    }
    # After
    @render_to('<yourapp>: <yourtemplate>.html')
    def <yourtemplate> (request):
    return {
    "message": "Hello World from <yourapp>!",
    "app_name": "<yourapp> :"
    }

  4. Don’t forget to add the new template to urls.py

View solution in original post

Champion

The easiest way I found was to build django app. where I did not want users to authenticate I created a new view in view.py and remove the @login_required decorator rendered it to a template. I realized this that Splunk use the django framework and should I bide by the same rule and conventions.

  1. Create your django app
  2. Create a template <yourtemplate>.html in $SPLUNK_HOME/<yourapp>/django/<yourapp>/template/
  3. New create a new function in views.py located $SPLUNK_HOME/<yourapp>/django/<yourapp>/


    # Before
    @render_to('<yourapp>: <yourtemplate>.html')
    @login_required
    def <yourtemplate> (request):
    return {
    "message": "Hello World from <yourapp>!",
    "app_name": "<yourapp> :"
    }
    # After
    @render_to('<yourapp>: <yourtemplate>.html')
    def <yourtemplate> (request):
    return {
    "message": "Hello World from <yourapp>!",
    "app_name": "<yourapp> :"
    }

  4. Don’t forget to add the new template to urls.py

View solution in original post

Esteemed Legend

Did anybody even try this? I am using v6.1.2 and when I got to my django URL (with "@login_required" removed) it does the same as every other Splunk URL: It prompts me to login!

0 Karma

Champion

You could use the Jscript SDK and embed your search. Also you might call a saved search owned by a user. Your best answer is to use the jscript or python sdk and which can uses embedded credentials.

0 Karma

Communicator

How would you go about running search jobs on this unauthenticated dashboard? I know I was trying it out a while ago and had trouble getting searches to run. I suppose you need to supply a user that can run the searches, but is an unauthenticated session allowed to do that?

0 Karma