Dashboards & Visualizations

Unauthenticated dashboard

bmacias84
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

bmacias84
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

bmacias84
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

woodcock
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

bmacias84
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

laserval
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
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

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 ...