Provides an object-oriented interface to access entities of a Splunk server.

package Splunk

 Methods

Constructs a new service with the specified parameters.

__construct(array $args) 
see \Splunk_Context::__construct()

Parameters

$args

array

{
username: (optional) The username to login with. Defaults to "admin".
password: (optional) The password to login with. Defaults to "changeme".
token: (optional) The authentication token to use. If provided, the username and password are ignored and there is no need to call login(). In the format "Splunk SESSION_KEY".
host: (optional) The hostname of the Splunk server. Defaults to "localhost".
port: (optional) The port of the Splunk server. Defaults to 8089.
scheme: (optional) The scheme to use: either "http" or "https". Defaults to "https".
namespace: (optional) Namespace that all object lookups will occur in by default. Defaults to Splunk_Namespace::createDefault().
http: (optional) An Http object that will be used for performing HTTP requests. This is intended for testing only.
}

Gets the hostname of the Splunk server.

getHost() : string
Inherited
inherited_from \Splunk_Context::getHost()

Returns

stringThe hostname of the Splunk server.

Gets the collection of indexes on this server.

getIndexes() : \Splunk_Collection

Returns

\Splunk_CollectionThe collection of indexes on this server.

Gets the collection of search jobs on this server.

getJobs() : \Splunk_Jobs

Returns

\Splunk_JobsThe collection of search jobs on this server.

Gets the default namespace for collection and entity operations.

getNamespace() : \Splunk_Namespace
Inherited
inherited_from \Splunk_Context::getNamespace()

Returns

\Splunk_NamespaceThe default namespace that will be used to perform collection and entity operations when none is explicitly specified.

Gets the port of the Splunk server.

getPort() : string
Inherited
inherited_from \Splunk_Context::getPort()

Returns

stringThe port of the Splunk server.

Gets an interface to send events to this server.

getReceiver() : \Splunk_Receiver

Returns

\Splunk_ReceiverAn interface to send events to this server.

Gets the collection of saved searches on this server.

getSavedSearches() : \Splunk_Collection

Returns

\Splunk_CollectionThe collection of saved searches on this server.

Gets the scheme to use.

getScheme() : string
Inherited
inherited_from \Splunk_Context::getScheme()

Returns

stringThe scheme to use: either "http" or "https".

Gets the token used to authenticate HTTP requests after logging in.

getToken() : string
Inherited
inherited_from \Splunk_Context::getToken()

Returns

stringThe token used to authenticate HTTP requests after logging in.

Executes the specified search query and returns results immediately.

oneshotSearch(string $search, array $args) : string

Parameters

$search

string

The search query for the job to perform.

$args

array

(optional) Job-specific creation arguments, merged with {
namespace: (optional) {Splunk_Namespace} The namespace in which to create the entity. Defaults to the service's namespace.
}
For details, see the "POST search/jobs" endpoint in the REST API Documentation.

Exceptions

\Splunk_IOException

Returns

stringThe search results, which can be parsed with Splunk_ResultsReader.

Sends an HTTP DELETE request to the endpoint at the specified path.

sendDelete(string $path, array $args) : \Splunk_HttpResponse
Inherited
see \Splunk_Http::delete()
inherited_from \Splunk_Context::sendDelete()

Parameters

$path

string

relative or absolute URL path.

$args

array

(optional) query parameters, merged with {
namespace: (optional) namespace to use, or NULL to use this context's default namespace.
}

Exceptions

\Splunk_IOException

Returns

\Splunk_HttpResponse

Sends an HTTP GET request to the endpoint at the specified path.

sendGet(string $path, array $args) : \Splunk_HttpResponse
Inherited
see \Splunk_Http::get()
inherited_from \Splunk_Context::sendGet()

Parameters

$path

string

relative or absolute URL path.

$args

array

(optional) query parameters, merged with {
namespace: (optional) namespace to use, or NULL to use this context's default namespace.
}

Exceptions

\Splunk_IOException

Returns

\Splunk_HttpResponse

Sends an HTTP POST request to the endpoint at the specified path.

sendPost(string $path, array $args) : \Splunk_HttpResponse
Inherited
see \Splunk_Http::post()
inherited_from \Splunk_Context::sendPost()

Parameters

$path

string

relative or absolute URL path.

$args

array

(optional) form parameters to send in the request body, merged with {
namespace: (optional) namespace to use, or NULL to use this context's default namespace.
}

Exceptions

\Splunk_IOException

Returns

\Splunk_HttpResponse

Sends an HTTP request to the endpoint at the specified path.

sendRequest(string $method, string $path, array $requestHeaders, string $requestBody, array $args) : \Splunk_HttpResponse
Inherited
see \Splunk_Http::request()
inherited_from \Splunk_Context::sendRequest()

Parameters

$method

string

the HTTP method (ex: 'GET' or 'POST').

$path

string

relative or absolute URL path.

$requestHeaders

array

(optional) dictionary of header names and values.

$requestBody

string

(optional) content to send in the request.

$args

array

(optional) query parameters, merged with {
namespace: (optional) namespace to use, or NULL to use this context's default namespace.
}

Exceptions

\Splunk_IOException

Returns

\Splunk_HttpResponse

Returns the absolute URL path.

abspath(string $path, \Splunk_Namespace | NULL $namespace) : string
Inherited
inherited_from \Splunk_Context::abspath()

Parameters

$path

string

Relative or absolute URL path.

$namespace

\Splunk_NamespaceNULL

Returns

stringAbsolute URL path.

Returns the standard headers to send on each HTTP request.

getRequestHeaders() 
Inherited
inherited_from \Splunk_Context::getRequestHeaders()

Sends a simple HTTP request to the endpoint at the specified path.

sendSimpleRequest($method, $path, $args) 
Inherited
inherited_from \Splunk_Context::sendSimpleRequest()

Parameters

$method

$path

$args

Returns the absolute URL.

url(string $path, \Splunk_Namespace | NULL $namespace) : string
Inherited
inherited_from \Splunk_Context::url()

Parameters

$path

string

Relative or absolute URL path.

$namespace

\Splunk_NamespaceNULL

Returns

stringAbsolute URL.

 Properties

 

$host 
Inherited
inherited_from \Splunk_Context::$$host
 

$http 
Inherited
inherited_from \Splunk_Context::$$http
 

$namespace 
Inherited
inherited_from \Splunk_Context::$$namespace
 

$password 
Inherited
inherited_from \Splunk_Context::$$password
 

$port 
Inherited
inherited_from \Splunk_Context::$$port
 

$scheme 
Inherited
inherited_from \Splunk_Context::$$scheme
 

$token 
Inherited
inherited_from \Splunk_Context::$$token
 

$username 
Inherited
inherited_from \Splunk_Context::$$username