SplunkJS Stack Configuration

Description

SplunkJS Stack must be configured to use SplunkJS Stack components in your own web applications that run outside of Splunk Web.

Library path

Dictionary keys

Key

Default

Description

app"search"Sets the namespace (the app context) for accessing Splunk entities.
authenticateRequired. A function or dictionary that authenticates a user's credentials in order to log in to Splunk.

This value can be one of the following:

  • A function with a signature (done) that logs in to Splunk and then invokes the done callback. The signature of done is (err, {sessionKey: key, username: username}). A falsy err is interpreted as success.
  • A dictionary of {username: username, password: password}. When a dictionary is passed, an default authentication function is generated internally.
customAdditional keys, only to be set when directed to by Splunk Support.
freeLicensefalseIndicates whether Splunk is using the free license.
host"localhost"The host name of the Splunk server.
locale"en-us"The locale code indicating the language for the user interface.
onDrilldownA function that is called as the default drilldown action. By default, this function is not defined.

The function signature is (params, newWindow):

  • params: The search parameters to send to the target view. These parameters correspond to the location the user clicked, such as the row or cell, or point on a chart or map.
  • newWindow: Indicates whether to open the target view in a new window.
onSessionExpiredauthenticateA function that is called when the session times out, or if the session key is not valid. By default, this function calls authenticate.

The function signature is (authFunction, done):

  • authFunction: The function defined for authenticate.
  • done: A callback function with the signature (err, {sessionKey: key, username: username}).
port8089The port number of the Splunk server.
proxyPathThe absolute URL path of the server-side proxy to the Splunk server. If this key is not set, Splunk is directly accessed using cross-origin resource sharing (CORS) at scheme://host:port.
scheme"https"The scheme for accessing the Splunk server.

Example

splunkjs.config({
    proxyPath: "/proxy",
    scheme: "https",
    host: "localhost",
    port: 8089,
    authenticate: function (done) {
        // TO DO: Custom function
    },
    onSessionExpired: function(authenticate, done) {
        // TO DO: Custom function
    },
    onDrilldown (drilldown) {
        // TO DO: Custom function
    }
});