Skip to content

Can't send payload #6

@akzReekoh

Description

@akzReekoh

Here's the code I'm using (got it directly from your npmjs page):

var SplunkLogger = require('splunk-logging').Logger;

var config = {
token: '',
url: ''
};

var Logger = new SplunkLogger(config);

var payload = {
// Message can be anything; doesn't have to be an object
message: {
temperature: "70F",
chickenCount: 500
}
};

console.log("Sending payload", payload);
Logger.send(payload, function(err, resp, body) {
// If successful, body will be { text: 'Success', code: 0 }
console.log("Response from Splunk", body);
});

And I always get this error:
/home/adinglasan/Desktop/splunk/node_modules/splunk-logging/splunklogger.js:466
if (!requestError && body && body.code.toString() !== "0") {
^

TypeError: Cannot read property 'toString' of undefined
at Request._callback (/home/adinglasan/Desktop/splunk/node_modules/splunk-logging/splunklogger.js:466:55)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions