# winston-splunk-http-transport

> A simple winston transport for logging to splunk.

Latest version **1.1.0** (published 2023-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install winston-splunk-http-transport
pnpm add winston-splunk-http-transport
yarn add winston-splunk-http-transport
bun add winston-splunk-http-transport
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-03-21 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben Whatley |
| Maintainers | darklordzw |
| Keywords | splunk, winston |

## Links

- npm: https://www.npmjs.com/package/winston-splunk-http-transport
- Repository: https://github.com/darklordzw/winston-splunk-http-transport
- Homepage: https://github.com/darklordzw/winston-splunk-http-transport#readme
- Issues: https://github.com/darklordzw/winston-splunk-http-transport/issues
- npm.io page: https://npm.io/package/winston-splunk-http-transport

## Dependencies (3)

- [triple-beam](https://npm.io/package/triple-beam.md) 1.3.0
- [splunk-logging](https://npm.io/package/splunk-logging.md) 0.11.1
- [winston-transport](https://npm.io/package/winston-transport.md) 4.5.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-03-21
- 1.0.4 — 2020-01-06
- 1.0.3 — 2019-02-26
- 1.0.2 — 2019-01-09
- 1.0.1 — 2019-01-01
- 1.0.0 — 2019-01-01
- 0.0.5 — 2018-12-27
- 0.0.4 — 2018-12-27
- 0.0.3 — 2018-12-21
- 0.0.2 — 2018-12-21
- 0.0.1 — 2018-12-21

## README

# winston-splunk-http-transport

A simple [winston] transport for logging to [Splunk] via the [HTTP Event Collector].

Log events are sent in batches by default. To disable batching, set the "splunk.batchInterval" config param to 0.

## Installation

```sh
npm install --save winston winston-splunk-http-transport
```

## Usage

```javascript
const winston = require("winston");
const SplunkTransport = require("winston-splunk-http-transport");

// Now use winston as normal
const logger = winston.createLogger({
  transports: [new SplunkTransport({ splunk: { token: "your token" } })]
});

logger.info("Hello world!");
```

## API

### splunkTransport = new SplunkTransport(opts);

Create a new instance of `SplunkTransport`. Takes the following configuration:

- **opts:** Transport configuration options.
- **opts.splunk:** Splunk-specific transport options.
- **opts.splunk.token:** The token used for connecting to the Splunk HTTP appender.
- **[opts.splunk.source=winston]:** The value used for the "source" metadata passed to Splunk.
- **[opts.splunk.sourcetype=winston-splunk-http-transport]:** The value used for the "sourcetype" metadata passed to Splunk.
- **[opts.batchInterval=1000]:** The number of milliseconds to wait before flushing logs.
- **[opts.maxBatchCount=10]:** The number of logs to batch before flushing.
- **[opts.maxBatchSize=1024]:** The size of the batch, in bytes, to accumulate before flushing.
- **[opts.splunk.maxRetries=10]:** The number of times the transport should retry sending failed batches.
- **[opts.splunk.url=https://localhost:8088]:** The url used to connect to the Splunk appender.
- **[opts.splunk.index]:** The Splunk index to log to. Logs to the default index for the token if not specified.

[winston]: https://github.com/winstonjs/winston
[splunk]: http://www.splunk.com
[http event collector]: http://dev.splunk.com/view/event-collector/SP-CAAAE6M

---
_Source: https://npm.io/package/winston-splunk-http-transport · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
