actions

splunkjs.Service.FiredAlert.actions

Returns this alert's actions (such as notifying by email, running a script, adding to RSS, tracking in Alert Manager, and enabling summary indexing).

Syntax

actions: function()

Return

Array.

of actions, an empty {Array} if no actions

alertType

splunkjs.Service.FiredAlert.alertType

Returns this alert's type.

Syntax

alertType: function()

Return

String.

the alert's type.

expirationTime

splunkjs.Service.FiredAlert.expirationTime

Returns the rendered expiration time for this alert.

This method is available in Splunk 4.3 and later.

Syntax

expirationTime: function()

Return

String.

init

splunkjs.Service.FiredAlert.init

Constructor for splunkjs.Service.FiredAlert.

Syntax

init: function(service, name, namespace)

Parameters

Name Type Description
service splunkjs.Service

A Service instance.

name String

The name for the new alert group.

namespace Object

Namespace information:
- owner (string): The Splunk username, such as "admin". A value of "nobody" means no specific user. The "-" wildcard means all users.
- app (string): The app context for this resource (such as "search"). The "-" wildcard means all apps.
- sharing (string): A mode that indicates how the resource is shared. The sharing mode can be "user", "app", "global", or "system".

Return

splunkjs.Service.FiredAlert.

A new splunkjs.Service.FiredAlert instance.

isDigestMode

splunkjs.Service.FiredAlert.isDigestMode

Indicates whether the result is a set of events (digest) or a single event (per result).

This method is available in Splunk 4.3 and later.

Syntax

isDigestMode: function()

Return

Boolean.

true if the result is a digest, false if per result

path

splunkjs.Service.FiredAlert.path

Retrieves the REST endpoint path for this resource (with no namespace).

Syntax

path: function()

savedSearchName

splunkjs.Service.FiredAlert.savedSearchName

Returns the saved search for this alert.

Syntax

savedSearchName: function()

Return

String.

The saved search name, or {null} if not available.

severity

splunkjs.Service.FiredAlert.severity

Returns this alert's severity on a scale of 1 to 10, with 1 being the highest severity.

Syntax

severity: function()

Return

Number.

this alert's severity, -1 if not specified

sid

splunkjs.Service.FiredAlert.sid

Returns this alert's search ID (SID).

Syntax

sid: function()

Return

String.

This alert's SID, or {null} if not available.

triggerTime

splunkjs.Service.FiredAlert.triggerTime

Returns the time this alert was triggered.

Syntax

triggerTime: function()

Return

Number.

This alert's trigger time, or {null} if not available.

triggerTimeRendered

splunkjs.Service.FiredAlert.triggerTimeRendered

Returns this alert's rendered trigger time.

This method is available in Splunk 4.3 and later.

Syntax

triggerTimeRendered: function()

Return

String.

This alert's rendered trigger time, or {null} if not available.

triggeredAlertCount

splunkjs.Service.FiredAlert.triggeredAlertCount

Returns the count of triggered alerts.

This method is available in Splunk 4.3 and later.

Syntax

triggeredAlertCount: function()

Return

Number.

The number of triggered alerts, or -1 if not specified.

_load

splunkjs.Service.Entity._load

Loads the entity and stores the properties.

Syntax

_load: function(properties)

Parameters

Name Type Description
properties Object

The properties for this entity.

acl

splunkjs.Service.Entity.acl

Retrieves the access control list (ACL) information for this entity, which contains the permissions for accessing the entity.

Syntax

acl: function()

Return

Object.

The ACL.

author

splunkjs.Service.Entity.author

Retrieves the author information for this entity.

Syntax

author: function()

Return

String.

The author.

del

splunkjs.Service.Endpoint.del

Performs a relative DELETE request on an endpoint's path, combined with the parameters and a relative path if specified.

Syntax

del: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append to the endpoint path.

params Object

A dictionary of entity-specific parameters to add to the query string.

callback Function

A function to call when the request is complete: (err, response).

Examples

 // Will make a request to {service.prefix}/search/jobs/123456
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.delete("", {}, function() { console.log("DELETED"))});

disable

splunkjs.Service.Entity.disable

Disables the entity on the server.

Syntax

disable: function(callback)

Parameters

Name Type Description
callback Function

A function to call when the object is disabled: (err, entity).

enable

splunkjs.Service.Entity.enable

Enables the entity on the server.

Syntax

enable: function(callback)

Parameters

Name Type Description
callback Function

A function to call when the object is enabled: (err, entity).

fetch

splunkjs.Service.Entity.fetch

Refreshes the entity by fetching the object from the server and loading it.

Syntax

fetch: function(options, callback)

Parameters

Name Type Description
options Object

An optional dictionary of collection filtering and pagination options:
- count (integer): The maximum number of items to return.
- offset (integer): The offset of the first item to return.
- search (string): The search query to filter responses.
- sort_dir (string): The direction to sort returned items: “asc” or “desc”.
- sort_key (string): The field to use for sorting (optional).
- sort_mode (string): The collating sequence for sorting returned items: “auto”, “alpha”, “alpha_case”, or “num”.

callback Function

A function to call when the object is retrieved: (err, resource).

fetchOnUpdate

splunkjs.Service.Entity.fetchOnUpdate

A static property that indicates whether to call fetch after an update to get the updated entity. By default, the entity is not fetched because the endpoint returns (echoes) the updated entity.

fields

splunkjs.Service.Entity.fields

Retrieves the fields information for this entity, indicating which fields are wildcards, required, and optional.

Syntax

fields: function()

Return

Object.

The fields information.

get

splunkjs.Service.Endpoint.get

Performs a relative GET request on an endpoint's path, combined with the parameters and a relative path if specified.

Syntax

get: function(relpath, params, callback, isAsync)

Parameters

Name Type Description
relpath String

A relative path to append to the endpoint path.

params Object

A dictionary of entity-specific parameters to add to the query string.

callback Function

A function to call when the request is complete: (err, response).

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/results?offset=1
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.get("results", {offset: 1}, function() { console.log("DONE"))});

post

splunkjs.Service.Endpoint.post

Performs a relative POST request on an endpoint's path, combined with the parameters and a relative path if specified.

Syntax

post: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append to the endpoint path.

params Object

A dictionary of entity-specific parameters to add to the body.

callback Function

A function to call when the request is complete: (err, response).

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/control
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.post("control", {action: "cancel"}, function() { console.log("CANCELLED"))});

properties

splunkjs.Service.Resource.properties

Retrieves the current properties for this resource.

Syntax

properties: function()

Return

Object.

The properties.

published

splunkjs.Service.Entity.published

Retrieves the published time for this entity.

Syntax

published: function()

Return

String.

The published time.

reload

splunkjs.Service.Entity.reload

Reloads the entity on the server.

Syntax

reload: function(callback)

Parameters

Name Type Description
callback Function

A function to call when the object is reloaded: (err, entity).

remove

splunkjs.Service.Entity.remove

Deletes the entity from the server.

Syntax

remove: function(callback)

Parameters

Name Type Description
callback Function

A function to call when the object is deleted: (err).

state

splunkjs.Service.Resource.state

Retrieves the current full state (properties and metadata) of this resource.

Syntax

state: function()

Return

Object.

The current full state of this resource.

update

splunkjs.Service.Entity.update

Updates the entity on the server.

Syntax

update: function(props, callback)

Parameters

Name Type Description
props Object

The properties to update the object with.

callback Function

A function to call when the object is updated: (err, entity).

updated

splunkjs.Service.Entity.updated

Retrieves the updated time for this entity.

Syntax

updated: function()

Return

String.

The updated time.