_writeTo

splunkjs.ModularInputs.Event._writeTo

Writes an XML representation of this, and Event object to the provided Stream, starting at the provided offset.

If this.data is undefined, or if there is an error writing to the provided Stream, an error will be thrown.

Syntax

Event.prototype._writeTo = function(stream)

Parameters

Name Type Description
stream Object

A Stream object to write this Event to.

formatTime

splunkjs.ModularInputs.Event.formatTime

Formats a time for Splunk, should be something like 1372187084.000.

Syntax

Event.formatTime = function(time)

Parameters

Name Type Description
time Anything

The unformatted time in seconds or milliseconds, typically a String, Number, or Date Object.

Return

Number.

The formatted time in seconds.

Examples

// When the time parameter is a string.
var stringTime = "1372187084";
var stringTimeFormatted = Event.formatTime(stringTime);
// When the time parameter is a number, no decimals.
var numericalTime = 1372187084;
var numericalTimeFormatted = Event.formatTime(numericalTime);
// When the time parameter is a number, with decimals.
var decimalTime = 1372187084.424;
var decimalTimeFormatted = Event.formatTime(decimalTime);
// When the time parameter is a Date object.
var dateObjectTime = Date.now();
var dateObjectTimeFormatted = Event.formatTime(dateObjectTime);