3.1.8 • Published 1 year ago

winston-splunk-httplogger v3.1.8

Weekly downloads
2,938
License
MIT
Repository
github
Last release
1 year ago

winston-splunk-httplogger

A Winston transport for logging to Splunk with a HTTP Event Collector.

NOTE

This project is no longer under active development. I can reasonably accept PRs, providing they include unit tests for the functionality and pass all existing tests. However, I do not have the ability to test against a live Splunk service.

Compatibility

Winston >= 3.0.0 is required for winston-splunk-httplogger >= 2.0.0. Please use version 1.2.2 for legacy Winston support.

Installation

npm install --save winston winston-splunk-httplogger

Usage

var winston = require('winston'),
    SplunkStreamEvent = require('winston-splunk-httplogger');

var splunkSettings = {
    token: process.env.SPLUNK_TOKEN,
    host: process.env.SPLUNK_HOST || 'localhost'
};

// Now use winston as normal
var logger = new winston.Logger({
    transports: [
        new winston.transports.Console(),
        new SplunkStreamEvent({ splunk: splunkSettings })
    ]
});

logger.info('This is sent to Splunk');

API

splunkTransport = new SplunkStreamEvent(config);

Create a new instance of SplunkStreamEvent. Takes the following configuration:

Configuring Splunk

  1. Log into your Splunk instance as an Administrator
  2. Go to Settings > Data Inputs
  3. Click on HTTP Event Collector under Local inputs
  4. Click on New Token
  5. Walk through the wizard to configure your new HTTP Event Collector

Splunk will provide you with a token at the end of the wizard. You need to insert that token into the splunk object you use to create the SplunkStreamEvent() object. In the example above, this is done by placing the token in the SPLUNK_TOKEN environment variable.

See Also

3.1.8

1 year ago

3.1.7

1 year ago

3.1.6

1 year ago

3.1.3

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.3.3

4 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago