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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Fuel Your Journey: What’s Waiting for You at the .conf26 Acceleration Station

Navigating the show floor at .conf26 isn't just about keynotes and technical breakout sessions; it's also ...

Join the Final Session of the Data Management & Federation Bootcamp Series

Over the past three sessions of the Data Management & Federation Bootcamp Series, we've explored how to build ...

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...