client/splunk.js
function(event, params, callback) {
            if (!callback && utils.isFunction(params)) {
                callback = params;
                params = {};
            }
            
            callback = callback || function() {};
            params = params || {};
            
            // If the event is a JSON object, convert it to a string.
            if (utils.isObject(event)) {
                event = JSON.stringify(event);
            }
            
            var path = this.paths.submitEvent;
            var method = "POST";
            var headers = {"Content-Type": "text/plain"};
            var body = event;
            var get = params;
            var post = {};
            
            var req = this.request(
                path, 
                method, 
                get, 
                post, 
                body, 
                headers, 
                function(err, response) {
                    if (err) {
                        callback(err);
                    } 
                    else {
                        callback(null, response.data);
                    }
                }
            );
            
            return req;
        }
function(event, params, callback) {
            if (!callback && utils.isFunction(params)) {
                callback = params;
                params = {};
            }
            
            callback = callback || function() {};
            params = params || {};
            
            // If the event is a JSON object, convert it to a string.
            if (utils.isObject(event)) {
                event = JSON.stringify(event);
            }
            
            var path = this.paths.submitEvent;
            var method = "POST";
            var headers = {"Content-Type": "text/plain"};
            var body = event;
            var get = params;
            var post = {};
            
            var req = this.request(
                path, 
                method, 
                get, 
                post, 
                body, 
                headers, 
                function(err, response) {
                    if (err) {
                        callback(err);
                    } 
                    else {
                        callback(null, response.data);
                    }
                }
            );
            
            return req;
        }
function ( event , params , callback ) { if ( ! callback && utils . isFunction ( params ) ) { callback = params ; params = { } ; } callback = callback || function ( ) { } ; params = params || { } ; // If the event is a JSON object, convert it to a string. if ( utils . isObject ( event ) ) { event = JSON . stringify ( event ) ; } var path = this . paths . submitEvent ; var method = "POST" ; var headers = { "Content-Type" : "text/plain" } ; var body = event ; var get = params ; var post = { } ; var req = this . request ( path , method , get , post , body , headers , function ( err , response ) { if ( err ) { callback ( err ) ; } else { callback ( null , response . data ) ; } } ) ; return req ; }
Logs an event to Splunk.

@example

service.log("A new event", {index: "_internal", sourcetype: "mysourcetype"}, function(err, result) {
console.log("Submitted event: ", result);
});

@param {String|Object} event The text for this event, or a JSON object.
@param {Object} params A dictionary of parameters for indexing:
- `index` (_string_): The index to send events from this input to.
- `host` (_string_): The value to populate in the Host field for events from this data input.
- `host_regex` (_string_): A regular expression used to extract the host value from each event.
- `source` (_string_): The value to populate in the Source field for events from this data input.
- `sourcetype` (_string_): The value to populate in the Sourcetype field for events from this data input.
@param {Function} callback A function to call when the event is submitted: `(err, result)`.

@endpoint receivers/simple
@method splunkjs.Service
Logs an event to Splunk .