Skip to content
A Bunyan stream for Splunk's HTTP Event Collector
JavaScript
Branch: master
Clone or download
Latest commit 82d0811 Nov 12, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Update retry example to retry 10 times Dec 9, 2015
test fix stale version number in tests Nov 12, 2018
.gitignore Update code to match common logger Sep 12, 2015
.jshintignore Create a SplunkStream for Bunyan loggging Aug 17, 2015
.jshintrc
.npmignore Add .npmignore Sep 15, 2015
.travis.yml Drop support for end of life Node versions Nov 1, 2018
CHANGELOG.md Bump version Nov 12, 2018
CONTRIBUTING.md Add changelog, readme, license & contributing notes Sep 17, 2015
LICENSE Add changelog, readme, license & contributing notes Sep 17, 2015
README.md Bump version Nov 12, 2018
index.js fix bad regex Nov 12, 2018
package-lock.json Bump version Nov 12, 2018
package.json

README.md

Splunk HTTP Event Collector Stream for Bunyan

Version 0.10.1

This project provides a Bunyan stream for HTTP Event Collector in Splunk Enterprise and Splunk Cloud.

Requirements

  • Node.js v4 or later.
  • Splunk Enterprise 6.3.0 or later, or Splunk Cloud.
  • An HTTP Event Collector token from your Splunk Enterprise or Splunk Cloud server.
  • Bunyan (npm install --save bunyan).

Installation

First, update npm to the latest version by running: sudo npm install npm -g.

Then run: npm install --save splunk-bunyan-logger.

Usage

See the examples folder for usage examples:

  • all_batching.js: Shows how to configure a Bunyan Stream with the 3 batching settings: batchInterval, maxBatchCount, & maxBatchSize.
  • basic.js: Shows how to configure a Bunyan stream and send a log message to Splunk.
  • custom_format.js: Shows how to configure a Bunyan Stream to log messages to Splunk using a custom format.
  • manual_batching.js: Shows how to queue log messages, and send them in batches by manually calling flush().
  • retry.js: Shows how to configure retries on errors.

SSL

Note: SSL certificate validation is diabled by default. To enable it, set logger.requestOptions.strictSSL = true on your SplunkStream instance:

var bunyan = require("bunyan");
var splunkBunyan = require("splunk-bunyan-logger");

var config = {
    token: "your-token-here",
    url: "https://splunk.local:8088"
};

var splunkStream = splunkBunyan.createStream(config);
// Enable SSL certificate validation
stream.logger.requestOptions.strictSSL = true;

// Note: splunkStream must be set to an element in the streams array
var Logger = bunyan.createLogger({
    name: "my logger",
    streams: [
        splunkStream
    ]
});

Basic example

var bunyan = require("bunyan");
var splunkBunyan = require("splunk-bunyan-logger");

var config = {
    token: "your-token-here",
    url: "https://splunk.local:8088"
};

var splunkStream = splunkBunyan.createStream(config);

// Note: splunkStream must be set to an element in the streams array
var Logger = bunyan.createLogger({
    name: "my logger",
    streams: [
        splunkStream
    ]
});

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

console.log("Sending payload", payload);
Logger.info(payload, "Chicken coup looks stable.");

Community

Stay connected with other developers building on Splunk software.

Email devinfo@splunk.com
Issues https://github.com/splunk/splunk-bunyan-logger/issues/
Answers http://answers.splunk.com/
Blog http://blogs.splunk.com/dev/
Twitter @splunkdev

Contact us

You can reach the developer platform team at devinfo@splunk.com.

License

The Splunk HTTP Event Collector Stream for Bunyan is licensed under the Apache License 2.0. Details can be found in the LICENSE file.

You can’t perform that action at this time.