Pino transport layer to splunk-events
npm install pino-splunk-loggerPino Splunk Logger is a fork off the project 'pino-splunk-events' by vtex (https://github.com/vtex/pino-splunk-events)
Instead of using splunk-events we use splunk-logging
``bash`
$ npm install pino-splunk-logger
`bash`
$ node app.js | npx pino-splunk-logger --endpoint=YOUR_SPLUNK_ENDPOINT --token=YOUR_SPLUNK_TOKEN
#### Node (development mode)
`ts
import { PrettyConsole } from 'pino-splunk-logger/lib/core/PrettyConsole'
const logger = pino({
prettyPrint: {
messageFormat: PrettyConsole.messageFormat,
},
})
`
#### Browser (production mode)
`ts
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)
`ts
import { PrettyConsole } from 'pino-splunk-events/lib/core/PrettyConsole'
import pino from 'pino'
const logger = pino({
browser: {
write: PrettyConsole.print,
},
})
`
| Log Level | Splunk Query |
| --------- | -------------------------- |
| trace | level=Debug type=Info |
| debug | level=Debug type=Info |
| info | level=Important type=Info |
| warn | level=Important type=Warn |
| error | level=Important type=Error |
| fatal | level=Critical type=Error |
`bashterminal 1
$ yarn install
$ cd example && yarn installstarts fake splunk server
$ yarn server:start
$3
Use
npx chan added|fixed|etc "my change"And after setting a changelog, run:
`shell
yarn release
``Released under MIT License.