Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

pino-splunk-events

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-splunk-events

Pino transport layer to splunk-events

latest
Source
npmnpm
Version
0.0.11
Version published
Weekly downloads
98
88.46%
Maintainers
4
Weekly downloads
 
Created
Source

npm Conventional Commits GitHub

pino-splunk-events

Install

$ npm install pino-splunk-events

Usage

$ node app.js | npx pino-splunk-events --endpoint=YOUR_SPLUNK_ENDPOINT --token=YOUR_SPLUNK_TOKEN

Node (development mode)

import { PrettyConsole } from 'pino-splunk-events/lib/core/PrettyConsole'

const logger = pino({
  prettyPrint: {
    messageFormat: PrettyConsole.messageFormat,
  },
})

Browser (production mode)

import { getPinoBrowserWriteLog } from 'pino-splunk-events/lib/browser'
import SplunkEvents from 'splunk-events'
import pino from 'pino'

const splunk = new SplunkEvents({
  endpoint: process.env.SPLUNK_ENDPOINT,
  token: process.env.SPLUNK_TOKEN,

  // IMPORTANT! You need to set this flag
  // to permit send nested data to splunk
  // otherwise it will fails when try to
  // send some log with nested data
  shouldParseEventData: false,
})

const logger = pino({
  browser: {
    write: getPinoBrowserWriteLog(splunk),
  },
})

Browser (development mode)

import { PrettyConsole } from 'pino-splunk-events/lib/core/PrettyConsole'
import pino from 'pino'

const logger = pino({
  browser: {
    write: PrettyConsole.print,
  },
})

Table logs level to splunk

Log LevelSplunk Query
tracelevel=Debug type=Info
debuglevel=Debug type=Info
infolevel=Important type=Info
warnlevel=Important type=Warn
errorlevel=Important type=Error
fatallevel=Critical type=Error

Running example

# terminal 1
$ yarn install
$ cd example && yarn install
# starts fake splunk server
$ yarn server:start

# terminal 2
# sends events to fake splunk server
$ yarn logger:start

Deploy / Release new tags

Use npx chan added|fixed|etc "my change"

And after setting a changelog, run:

yarn release

License

Released under MIT License.

Keywords

pino

FAQs

Package last updated on 12 Sep 2022

Did you know?

Socket

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