@@ -33,9 +33,9 @@ function _err(err, context) {
3333}
3434
3535/**
36- * The default format for Splunk events.
36+ * The default format for Splunk Enterprise or Splunk Cloud events.
3737 *
38- * This function can be overwritten, and can return any type (string, object, array, etc.)
38+ * This function can be overwritten, and can return any type (string, object, array, and so on).
3939 *
4040 * @param {anything } [message] - The event message.
4141 * @param {string } [severity] - The event severity.
@@ -50,8 +50,9 @@ function _defaultEventFormatter(message, severity) {
5050}
5151
5252/**
53- * Constructs a SplunkLogger, to send events to Splunk via the HTTP Event Collector.
54- * See <code>defaultConfig</code> for default configuration settings.
53+ * Constructs a SplunkLogger, to send events to Splunk Enterprise or Splunk Cloud
54+ * via HTTP Event Collector. See <code>defaultConfig</code> for default
55+ * configuration settings.
5556 *
5657 * @example
5758 * var SplunkLogger = require("splunk-logging").Logger;
@@ -67,20 +68,20 @@ function _defaultEventFormatter(message, severity) {
6768 * @property {object } config - Configuration settings for this <code>SplunkLogger</code> instance.
6869 * @param {object } requestOptions - Options to pass to <code>{@link https://github.com/request/request#requestpost|request.post()}</code>.
6970 * See the {@link http://github.com/request/request|request documentation} for all available options.
70- * @property {object[] } serializedContextQueue - Queue of serialized <code>context</code> objects to be sent to Splunk.
71+ * @property {object[] } serializedContextQueue - Queue of serialized <code>context</code> objects to be sent to Splunk Enterprise or Splunk Cloud .
7172 * @property {function } eventFormatter - Formats events, returning an event as a string, <code>function(message, severity)</code>.
7273 * Can be overwritten, the default event formatter will display event and severity as properties in a JSON object.
7374 * @property {function } error - A callback function for errors: <code>function(err, context)</code>.
7475 * Defaults to <code>console.log</code> both values;
7576 *
7677 * @param {object } config - Configuration settings for a new [SplunkLogger]{@link SplunkLogger}.
77- * @param {string } config.token - Splunk HTTP Event Collector token, required.
78+ * @param {string } config.token - HTTP Event Collector token, required.
7879 * @param {string } [config.name=splunk-javascript-logging/0.9.0] - Name for this logger.
79- * @param {string } [config.host=localhost] - Hostname or IP address of Splunk server.
80- * @param {string } [config.maxRetries=0] - How many times to retry when HTTP POST to Splunk fails.
81- * @param {string } [config.path=/services/collector/event/1.0] - URL path to send data to on the Splunk server.
82- * @param {string } [config.protocol=https] - Protocol used to communicate with the Splunk server, <code>http</code> or <code>https</code>.
83- * @param {number } [config.port=8088] - HTTP Event Collector port on the Splunk server.
80+ * @param {string } [config.host=localhost] - Hostname or IP address of Splunk Enterprise or Splunk Cloud server.
81+ * @param {string } [config.maxRetries=0] - How many times to retry when HTTP POST to Splunk Enterprise or Splunk Cloud fails.
82+ * @param {string } [config.path=/services/collector/event/1.0] - URL path to send data to on the Splunk Enterprise or Splunk Cloud server.
83+ * @param {string } [config.protocol=https] - Protocol used to communicate with the Splunk Enterprise or Splunk Cloud server, <code>http</code> or <code>https</code>.
84+ * @param {number } [config.port=8088] - HTTP Event Collector port on the Splunk Enterprise or Splunk Cloud server.
8485 * @param {string } [config.url] - URL string to pass to {@link https://nodejs.org/api/url.html#url_url_parsing|url.parse}. This will try to set
8586 * <code>host</code>, <code>path</code>, <code>protocol</code>, <code>port</code>, <code>url</code>. Any of these values will be overwritten if
8687 * the corresponding property is set on <code>config</code>.
@@ -147,7 +148,7 @@ var defaultConfig = {
147148} ;
148149
149150var defaultRequestOptions = {
150- json : true , // Sets the content-type header to application/json
151+ json : true , // Sets the content-type header to application/json.
151152 strictSSL : false
152153} ;
153154
@@ -275,7 +276,7 @@ SplunkLogger.prototype._initializeConfig = function(config) {
275276 // Has the interval timer already started, and the interval changed to a different duration?
276277 var changeTimer = this . _timerID && this . _timerDuration !== ret . batchInterval && ret . batchInterval > 0 ;
277278
278- // Upsert the timer
279+ // Enable the timer
279280 if ( startTimer || changeTimer ) {
280281 this . _enableTimer ( ret . batchInterval ) ;
281282 }
@@ -323,7 +324,7 @@ SplunkLogger.prototype._validateMessage = function(message) {
323324} ;
324325
325326/**
326- * Initialized metadata, if <code>context.metadata</code> is falsey or empty,
327+ * Initializes metadata. If <code>context.metadata</code> is false or empty,
327328 * return an empty object.
328329 *
329330 * @param {object } context
@@ -413,7 +414,7 @@ SplunkLogger.prototype._post = function(requestOptions, callback) {
413414} ;
414415
415416/**
416- * Sends events to Splunk, optionally with retries on non-Splunk errors.
417+ * Sends events to Splunk Enterprise or Splunk Cloud , optionally with retries on non-Splunk errors.
417418 *
418419 * @param context
419420 * @param {function } callback - A callback function: <code>function(err, response, body)</code>
@@ -434,13 +435,12 @@ SplunkLogger.prototype._sendEvents = function(context, callback) {
434435 requestOptions . headers [ "Content-Type" ] = "application/x-www-form-urlencoded" ;
435436 requestOptions . url = this . config . protocol + "://" + this . config . host + ":" + this . config . port + this . config . path ;
436437
437-
438438 // Initialize the context again, right before using it
439439 context = this . _initializeContext ( context ) ;
440440
441441 var that = this ;
442442
443- var splunkError = null ; // Errors returned by Splunk
443+ var splunkError = null ; // Errors returned by Splunk Enterprise or Splunk Cloud
444444 var requestError = null ; // Any non-Splunk errors
445445
446446 // References so we don't have to deal with callback parameters
@@ -462,7 +462,7 @@ SplunkLogger.prototype._sendEvents = function(context, callback) {
462462 _response = resp ;
463463 _body = body ;
464464
465- // Try to parse an error response from Splunk
465+ // Try to parse an error response from Splunk Enterprise or Splunk Cloud
466466 if ( ! requestError && body && body . code . toString ( ) !== "0" ) {
467467 splunkError = new Error ( body . text ) ;
468468 splunkError . code = body . code ;
@@ -501,7 +501,7 @@ SplunkLogger.prototype._sendEvents = function(context, callback) {
501501 *
502502 * var logger = new SplunkLogger(config);
503503 *
504- * // Payload to send to Splunk's Event Collector
504+ * // Payload to send to HTTP Event Collector.
505505 * var payload = {
506506 * message: {
507507 * temperature: "70F",
@@ -530,11 +530,11 @@ SplunkLogger.prototype._sendEvents = function(context, callback) {
530530 * @param {(object|string|Array|number|bool) } context.message - Data to send to Splunk.
531531 * @param {string } [context.severity=info] - Severity level of this event.
532532 * @param {object } [context.metadata] - Metadata for this event.
533- * @param {string } [context.metadata.host] - If not specified, Splunk will decide the value.
534- * @param {string } [context.metadata.index] - The Splunk index to send data to.
535- * If not specified, Splunk will decide the value.
536- * @param {string } [context.metadata.source] - If not specified, Splunk will decide the value.
537- * @param {string } [context.metadata.sourcetype] - If not specified, Splunk will decide the value.
533+ * @param {string } [context.metadata.host] - If not specified, Splunk Enterprise or Splunk Cloud will decide the value.
534+ * @param {string } [context.metadata.index] - The Splunk Enterprise or Splunk Cloud index to send data to.
535+ * If not specified, Splunk Enterprise or Splunk Cloud will decide the value.
536+ * @param {string } [context.metadata.source] - If not specified, Splunk Enterprise or Splunk Cloud will decide the value.
537+ * @param {string } [context.metadata.sourcetype] - If not specified, Splunk Enterprise or Splunk Cloud will decide the value.
538538 * @param {function } [callback] - A callback function: <code>function(err, response, body)</code>.
539539 * @throws Will throw an error if the <code>context</code> parameter is malformed.
540540 * @public
@@ -557,7 +557,7 @@ SplunkLogger.prototype.send = function(context, callback) {
557557} ;
558558
559559/**
560- * Manually send all events in <code>this.serializedContextQueue</code> to Splunk.
560+ * Manually send all events in <code>this.serializedContextQueue</code> to Splunk Enterprise or Splunk Cloud .
561561 *
562562 * @param {function } [callback] - A callback function: <code>function(err, response, body)</code>.
563563 * @public
@@ -579,4 +579,4 @@ SplunkLogger.prototype.flush = function(callback) {
579579 this . _sendEvents ( context , callback ) ;
580580} ;
581581
582- module . exports = SplunkLogger ;
582+ module . exports = SplunkLogger ;
0 commit comments