# logstash-http-logger

> Logstash HTTP Logger for javascript

Latest version **1.0.12** (published 2021-07-08) · 0 weekly downloads

## Install

```sh
npm install logstash-http-logger
pnpm add logstash-http-logger
yarn add logstash-http-logger
bun add logstash-http-logger
```

## 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.0.12 |
| Published | 2021-07-08 |
| First published | 2021-06-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rafael Vilarinho |
| Maintainers | rafaelvilarinho |

## Links

- npm: https://www.npmjs.com/package/logstash-http-logger
- Repository: https://github.com/rafaelvilarinho/logstash-http-logger
- Homepage: https://github.com/rafaelvilarinho/logstash-http-logger#readme
- Issues: https://github.com/rafaelvilarinho/logstash-http-logger/issues
- npm.io page: https://npm.io/package/logstash-http-logger

## Dependencies (1)

- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^3.0.0

## Recent versions

- 1.0.12 (latest) — 2021-07-08
- 1.0.11 — 2021-07-08
- 1.0.10 — 2021-06-22
- 1.0.9 — 2021-06-22
- 1.0.8 — 2021-06-22
- 1.0.7 — 2021-06-22
- 1.0.6 — 2021-06-21
- 1.0.5 — 2021-06-21
- 1.0.4 — 2021-06-21
- 1.0.3 — 2021-06-21
- 1.0.2 — 2021-06-21
- 1.0.1 — 2021-06-21
- 1.0.0 — 2021-06-21

## README

# Logstash HTTP Logger

A simple logger with logstash integration using HTTP protocol.
### Logger Levels

- OFF: 0
- FATAL: 1
- ERROR: 2
- WARN: 3
- INFO: 4
- DEBUG: 5
- TRACE: 6
- ALL: 7

--
------

### Logger Level Visibility


| LEVEL |   FATAL   |   ERROR   |   WARN   |  INFO  |   DEBUG   |   TRACE   |
| :---: | :-------: | :-------: | :------: | -----: | :-------: | :-------: |
| OFF   |     x     |     x     |     x    |    x   |     x     |     x     |
| FATAL | &#x2611;  |     x     |     x    |    x   |     x     |     x     |
| ERROR | &#x2611;  | &#x2611;  |     x    |    x   |     x     |     x     |
| WARN  | &#x2611;  | &#x2611;  | &#x2611; |    x   |     x     |     x     |
| INFO  | &#x2611;  | &#x2611;  | &#x2611; |&#x2611;|     x     |     x     |
| DEBUG | &#x2611;  | &#x2611;  | &#x2611; |&#x2611;| &#x2611;  |     x     |
| TRACE | &#x2611;  | &#x2611;  | &#x2611; |&#x2611;| &#x2611;  | &#x2611;  |
| ALL   | &#x2611;  | &#x2611;  | &#x2611; |&#x2611;| &#x2611;  | &#x2611;  |

--
----
### Logger Configuration

```
{
  tags?: string[], // (optional)
  contextIdPropertyName?: string, // (optional) define your custom property name for context id
  defaultLayout?: Record<string, unknown> // (optional) define your custom log layout
}
```

--
---

### How to Use?

```
import LogstashHttpLogger from 'logstash-http-logger';

const config = {
  tags: ['logger-dev']
};

const Logger = new LogstashHttpLogger('url-logstash-with-port', 7, config); // Logger instance with ALL (7) level

Logger.info('Testing logger');
Logger.trace({ data: { test: true } });
Logger.error(new Error('Testing error'));

// Using Logger with a RequestId

Logger.setContextId('1234');

// These 3 statements will log with requestId = 1234
Logger.info('Testing logger with requestId');
Logger.trace({ data: { test: false } });
Logger.error(new Error('Testing error with requestId'));
```

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