Skip to content

Commit debf4fa

Browse files
authoredMay 17, 2024··
Add Parseable transport (#2466)
1 parent d567c57 commit debf4fa

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎docs/transports.md

+28
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ there are additional transports written by
5151
* [MySQL](#mysql-transport)
5252
* [New Relic](#new-relic-agent-transport)
5353
* [Papertrail](#papertrail-transport)
54+
* [Parseable](#parseable)
5455
* [PostgresQL](#postgresql-transport)
5556
* [Pusher](#pusher-transport)
5657
* [Sentry](#sentry-transport)
@@ -732,6 +733,33 @@ The Papertrail transport connects to a [PapertrailApp log destination](https://p
732733

733734
*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
734735

736+
### Parseable Transport
737+
738+
[Parseable](https://parseable.com/) is an open source, general purpose log analytics system. [Parseable-Winston](https://github.com/jybleau/parseable-node-loggers/tree/main/packages/winston#parseable-winston) is a Parseable transport for Winston.
739+
740+
```js
741+
// Using cjs
742+
const { ParseableTransport } = require('parseable-winston')
743+
const winston = require('winston')
744+
745+
const parseable = new ParseableTransport({
746+
url: process.env.PARSEABLE_LOGS_URL, // Ex: 'https://parsable.myserver.local/api/v1/logstream'
747+
username: process.env.PARSEABLE_LOGS_USERNAME,
748+
password: process.env.PARSEABLE_LOGS_PASSWORD,
749+
logstream: process.env.PARSEABLE_LOGS_LOGSTREAM, // The logstream name
750+
tags: { tag1: 'tagValue' } // optional tags to be added with each ingestion
751+
})
752+
753+
const logger = winston.createLogger({
754+
levels: winston.config.syslog.levels,
755+
transports: [parseable],
756+
defaultMeta: { instance: 'app', hostname: 'app1' }
757+
})
758+
759+
logger.info('User took the goggles', { userid: 1, user: { name: 'Rainier Wolfcastle' } })
760+
logger.warning('The goggles do nothing', { userid: 1 })
761+
```
762+
735763
### PostgresQL Transport
736764

737765
[@pauleliet/winston-pg-native](https://github.com/petpano/winston-pg-native) is a PostgresQL transport supporting Winston 3.X.

0 commit comments

Comments
 (0)
Please sign in to comment.