Socket
Socket
Sign inDemoInstall

winston-transport-splunk

Package Overview
Dependencies
78
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    winston-transport-splunk

winston transport for Splunk Event API


Version published
Weekly downloads
30
decreased by-55.88%
Maintainers
1
Install size
6.88 MB
Created
Weekly downloads
 

Readme

Source

winston-transport-splunk

A Splunk transport for winston.

Usage

    import winston from 'winston';
    import { Splunk } from 'winston-transport-splunk';
    
    
    cconst createTransports = (options) => {
        const transports = [];
        
        //
        // Create console and other transports
        //
        
        transports.push(new Splunk(options.splunk));
        return transports;
    };
     
    const options = {  
        console:{  
            level:'debug'
        },
        splunk:{  
            url: YOUR_SPLUNK_URL,
            index: YOUR_SPLUNK_INDEX,
            token: YOUR_SPLUNK_TOKEN,
            host: YOUR_SPLUNK_HOST,
            source: YOUR_SPLUNK_SOURCE,
            sourcetype:'api_json',
            maxRetries:0,
            level:'debug'
        }
    }
         
    const createLogger = options => winston.createLogger({
        levels: winston.config.npm.levels,
        format: winston.format.simple(),
        transports: createTransports(options)
    });

The Splunk transport is based on splunk-logging, and used winston-elasticsearch as a reference.

configuration options

  • source: The value used for the "source" metadata passed to Splunk.
  • sourcetype: The value used for the "sourcetype" metadata passed to Splunk.
  • batchInterval: The number of milliseconds to wait before flushing logs.
  • maxBatchCount: The number of logs to batch before flushing.
  • maxBatchSize: The size of the batch, in bytes, to accumulate before flushing.
  • maxRetries: The number of times the transport should retry sending failed batches.
  • url: The url used to connect to the Splunk. This is required
  • index: The Splunk index to log to.
  • token: The token used for connecting to the Splunk. This is required

This module uses splunk-logging to send events to Splunk, more details of configuration options can be found at splunk-logging.

Installation

Installing winston-transport-splunk

  $ npm install --save winston-transport-splunk

Run Linting

  npm run lint

Run Tests

Tests will be added soon.

  npm run test
Author: Sean Xiong @ Imaginationworks
License: MIT

Keywords

FAQs

Last updated on 06 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc