splunk / splunk-bunyan-logger

A Bunyan stream for Splunk's HTTP Event Collector
http://dev.splunk.com/
Apache License 2.0
19 stars 8 forks source link

Splunk HTTP Event Collector Stream for Bunyan

Version 0.11.0

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

Requirements

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:

Support

The Splunk HTTP Event Collector Stream for Bunyan is community-supported.

  1. You can find help through our community on Splunk Answers (use the logging-library-javascript tag to identify your questions).
  2. File issues on GitHub.

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

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.