Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexanbj/pino-splunk
Load pino logs into Splunk
https://github.com/alexanbj/pino-splunk
Last synced: about 1 month ago
JSON representation
Load pino logs into Splunk
- Host: GitHub
- URL: https://github.com/alexanbj/pino-splunk
- Owner: alexanbj
- License: mit
- Created: 2021-09-03T07:57:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T06:50:06.000Z (4 months ago)
- Last Synced: 2024-09-09T08:23:02.661Z (4 months ago)
- Language: TypeScript
- Size: 416 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pino-splunk
Load [pino](https://github.com/pinojs/pino) logs into
[Splunk](https://www.splunk.com/).The logs are sent in batches to reduce the load. The batch
## Install
```
# npm
npm i pino-splunk# yarn
yarn add pino-splunk# pnpm
pnpm i pino-splunk
```## Usage
```js
import pino from 'pino';const splunkTransport = pino.transport({
target: 'pino-splunk',
options: {
// These parameters are required
baseUrl: 'https://mysplunkserver.example.com:8088',
token: 'my-token',
source: 'my-app-name',
index: 'stage',// Optional parameters, default values listed
// Batching - Flushes the logs after given number of log events
flushSize: 10,
// Batching - Flushes the if the specified number of milliseconds has passed since the last log event
flushIntervalMs: 10000, // 10 seconds
// URL path for the Splunk instance
path: '/services/collector/event',
},
});const logger = pino({ level: 'info' }, splunkTransport);
```