Class: SplunkStream

SplunkStream

new SplunkStream(config)

A class that implements a raw writable stream.
Parameters:
Name Type Description
config object Configuration settings for a new SplunkLogger.
Properties
Name Type Attributes Default Description
token string HTTP Event Collector token, required.
name string <optional>
splunk-javascript-logging/0.9.3 Name for this logger.
host string <optional>
localhost Hostname or IP address of Splunk server.
maxRetries string <optional>
0 How many times to retry when HTTP POST to Splunk fails.
path string <optional>
/services/collector/event/1.0 URL path to send data to on the Splunk server.
protocol string <optional>
https Protocol used to communicate with the Splunk server, http or https.
port number <optional>
8088 HTTP Event Collector port on the Splunk server.
url string <optional>
URL string to pass to url.parse. This will try to set host, path, protocol, port, url. Any of these values will be overwritten if the corresponding property is set on config.
level string <optional>
info Logging level to use, will show up as the severity field of an event, see SplunkLogger.levels for common levels.
batchInterval number <optional>
0 Automatically flush events after this many milliseconds. When set to a non-positive value, events will be sent one by one. This setting is ignored when non-positive.
maxBatchSize number <optional>
0 Automatically flush events after the size of queued events exceeds this many bytes. This setting is ignored when non-positive.
maxBatchCount number <optional>
1 Automatically flush events after this many events have been queued. Defaults to flush immediately on sending an event. This setting is ignored when non-positive.
Properties:
Name Type Description
config object Configuration settings for this SplunkStream instance.
contextQueue Array.<object> Queue of context objects to be sent to Splunk.
error function A callback function for errors: function(err, context). Defaults to console.log both values;
Implements:
Source:

Members

logger :SplunkLogger

Type:
  • SplunkLogger
Source:

Methods

config() → {Object}

Returns the configuration for this logger. See SplunkStream.
Source:
Returns:
Configuration for this logger.
Type
Object

send()

A callback function called after sending a request to Splunk: function(err, response, body). Defaults to an empty function.
Source:

write(data)

The write() function for SplunkStream. Bunyan will call this function when a user logs a message. See Bunyan raw streams.
Parameters:
Name Type Description
data object The data object is provided by Bunyan.
Source: