Getting Data In

User-specific browser session timeout?

the_wolverine
Champion

I have a special user (her name is "dashboard") that needs a session timeout of 0. Is it possible to set no timeout for a specific user?

Tags (3)
1 Solution

southeringtonp
Motivator

As far as I'm aware it's not possible as a configuration option per-user, but that doesn't mean you can't do it. 🙂

Need to think this through a little more, but you should be able to do something along these lines:

  • Create a separate app called dashboard.
  • Set your new dashboard app as the default app for that user, either via Manager->Access Controls->Users or via user_prefs.conf.
  • Make sure that all of your required dashboard views are accessible through that app context. (Either copy them, or set them to global scope)
  • Paste the following into application.js for that app:
  • $(document).ready(function() {
        Splunk.Session.instance.UI_INACTIVITY_TIMEOUT = 0;
        Splunk.Session.instance.timeoutDelay = 0;
    
        function overrideStartTimeout() {
            return;
        }
        Splunk.Session.instance.startTimeout = overrideStartTimeout;
        Splunk.Session.instance.stopTimeout();
    });
    


    If you really want to do it within another app like search, you can do the same thing, but wrap it in an if statement that checks the username. Getting the username may be non-trivial - usually it shows an auth token but not a name. If you have an AccountBar module, you can get it from there; if not, it may be hiding somewhere in the DOM, but I haven't seen it.

    I still think, however, that compartmentalizing into a dedicated app is less risky.

    lastKnownUser = 'unknown'
    
    function getUserName() {
        // Only works for pages that have an AccountBar module
        text = jQuery('.accountBarItems').text()
        r = /Logged in as (\S+)/
        matches = r.exec(text)
        if (matches) {
            lastKnownUser = matches[1];
        }
        return lastKnownUser;
    }
    
    $(document).ready(function() {
        if ( getUserName() == "dashboard" ) {
            Splunk.Session.instance.UI_INACTIVITY_TIMEOUT = 0;
            Splunk.Session.instance.timeoutDelay = 0;
    
            function overrideStartTimeout() {
                return;
            }
            Splunk.Session.instance.startTimeout = overrideStartTimeout;
            Splunk.Session.instance.stopTimeout();
        }
    });
    

    View solution in original post

    southeringtonp
    Motivator

    As far as I'm aware it's not possible as a configuration option per-user, but that doesn't mean you can't do it. 🙂

    Need to think this through a little more, but you should be able to do something along these lines:

  • Create a separate app called dashboard.
  • Set your new dashboard app as the default app for that user, either via Manager->Access Controls->Users or via user_prefs.conf.
  • Make sure that all of your required dashboard views are accessible through that app context. (Either copy them, or set them to global scope)
  • Paste the following into application.js for that app:
  • $(document).ready(function() {
        Splunk.Session.instance.UI_INACTIVITY_TIMEOUT = 0;
        Splunk.Session.instance.timeoutDelay = 0;
    
        function overrideStartTimeout() {
            return;
        }
        Splunk.Session.instance.startTimeout = overrideStartTimeout;
        Splunk.Session.instance.stopTimeout();
    });
    


    If you really want to do it within another app like search, you can do the same thing, but wrap it in an if statement that checks the username. Getting the username may be non-trivial - usually it shows an auth token but not a name. If you have an AccountBar module, you can get it from there; if not, it may be hiding somewhere in the DOM, but I haven't seen it.

    I still think, however, that compartmentalizing into a dedicated app is less risky.

    lastKnownUser = 'unknown'
    
    function getUserName() {
        // Only works for pages that have an AccountBar module
        text = jQuery('.accountBarItems').text()
        r = /Logged in as (\S+)/
        matches = r.exec(text)
        if (matches) {
            lastKnownUser = matches[1];
        }
        return lastKnownUser;
    }
    
    $(document).ready(function() {
        if ( getUserName() == "dashboard" ) {
            Splunk.Session.instance.UI_INACTIVITY_TIMEOUT = 0;
            Splunk.Session.instance.timeoutDelay = 0;
    
            function overrideStartTimeout() {
                return;
            }
            Splunk.Session.instance.startTimeout = overrideStartTimeout;
            Splunk.Session.instance.stopTimeout();
        }
    });
    

    Brian_Osburn
    Builder

    Judging from http://www.splunk.com/base/Documentation/4.1.5/Admin/Configureusertimeouts,

    In addition to setting the splunkweb/splunkd session value, you can also specify the timeout for the user browser session by editing the ui_inactivity_timeout value in web.conf. The Splunk browser session will time out once this value is reached. The default is 60 minutes. If ui_inactivity_timeout is set to less than 1, there's no timeout -- the session will stay alive while the browser is open.

    But I'm not sure that can be applied to specific users or not..

    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!

    Observability Simplified: Combining User Experience, Application Performance & ...

    Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

    Event Series May & June: From Network Visibility to Service Intelligence

    Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

    Global Splunk User Group Events: May + June 2026

    Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...