# insomnia-plugin-usage-logger

> An Insomnia plugin for logging request and response details using Resurface. More info at: https://resurface.io

Latest version **1.0.6** (published 2024-03-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install insomnia-plugin-usage-logger
pnpm add insomnia-plugin-usage-logger
yarn add insomnia-plugin-usage-logger
bun add insomnia-plugin-usage-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.6 |
| Published | 2024-03-01 |
| First published | 2021-08-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 60.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ramón Márquez |
| Maintainers | resurfaceio |
| Keywords | log, record, history, logger, monitor, observability, security, HTTP, request, response, API, gateway, resurface, insomnia, plugin |

## Links

- npm: https://www.npmjs.com/package/insomnia-plugin-usage-logger
- Repository: https://github.com/resurfaceio/insomnia-plugin
- Homepage: https://github.com/resurfaceio/insomnia-plugin#readme
- Issues: https://github.com/resurfaceio/insomnia-plugin/issues
- npm.io page: https://npm.io/package/insomnia-plugin-usage-logger

## Dependencies (1)

- [resurfaceio-logger](https://npm.io/package/resurfaceio-logger.md) latest

## 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.0.6 (latest) — 2024-03-01
- 1.0.5 — 2024-02-27
- 1.0.3 — 2022-01-13
- 1.0.2 — 2021-08-26
- 1.0.1 — 2021-08-20
- 1.0.0 — 2021-08-20
- 0.1.0 — 2021-08-19

## README

# Graylog API Security Insomnia Plugin
Easily log API requests and responses to your own <a href="https://resurface.io">security data lake</a>.

[![License](https://img.shields.io/github/license/resurfaceio/insomnia-plugin)](https://github.com/resurfaceio/insomnia-plugin/blob/master/LICENSE)
[![Contributing](https://img.shields.io/badge/contributions-welcome-green.svg)](https://github.com/resurfaceio/insomnia-plugin/blob/master/CONTRIBUTING.md)

## Requirements

- Kubernetes
  - we officially support [microk8s](https://ubuntu.com/tutorials/install-a-local-kubernetes-with-microk8s), but
  - if you have docker desktop, [you also have k8s](https://docs.docker.com/desktop/kubernetes/)!
- [Graylog API Security](https://resurface.io/installation) -- first node is [free](https://go2.graylog.org/api-security-free)!

## Set up

- Go to *Insomnia > Preferences > Plugins*
- Type in
  ```
  insomnia-plugin-usage-logger
  ```
- Click **Install Plugin**.

  <img src="https://github.com/resurfaceio/insomnia-plugin/raw/master/assets/readme/insomnia_install.gif" width="768" height="498" />


  (Alternatively, check out the [manual installation](#manual-installation).)

- Add the [variables](#environment-variables) used by the logger to your Base Environment (or create a separate new Private/Shared environment for it).

  ```json
  {
      "USAGE_LOGGERS_URL": "http://localhost:7701/message",
      "USAGE_LOGGERS_RULES": "include debug"
  }
  ```

  <img src="https://github.com/resurfaceio/insomnia-plugin/raw/master/assets/readme/insomnia_environment.gif" width="768" height="498" />


That's it!

## Usage

- Make sure the plugin is enabled (also, if you created a new private/shared environment make sure to select it).
- Use Insomnia as you would normally.
- Go to `http://localhost:7700` to explore all your logs using the included Graylog API Security web UI

  <img src="https://github.com/resurfaceio/insomnia-plugin/raw/master/assets/readme/insomnia_usage.gif" width="768" height="498" />

- You can always disable the plugin if you want stop logging API calls temporarily

  <img src="https://github.com/resurfaceio/insomnia-plugin/raw/master/assets/readme/insomnia_disable.gif" width="768" height="498" />

Happy loggin' 📝

## Environment variables

This plugin has access to four environment variables, but only one them is required for the logger to work properly.

#### ✔ All API calls are sent to the database running inside the `resurface` container
The environment variable `USAGE_LOGGERS_URL` stores this address, which by default should be the string `"http://localhost:7701/message"`
#### ✔ All API calls are filtered using a set of rules (Optional)
The environment variable `USAGE_LOGGERS_RULES` stores these [logging rules](#protecting-user-privacy) as a string. Even though this variable is optional, it is recommended to set it to `"include debug"` or `"allow_http_url"` when trying the plugin for the first time.
#### ✔ Reponse bodies are logged up to a certain size (Optional)
If you are working with large response payloads and don't want to log the whole thing, you can use the environment variable `USAGE_LOGGERS_LIMIT`. It stores an integer value corresponding to the number of bytes after which a response body will not be logged (by default, this upper limit is 1 MiB).
#### ✔ The Logger can be disabled even if the plugin is enabled (Optional)
By setting the environment variable `USAGE_LOGGERS_DISABLE` to `true` the logger will be disabled and no API calls will be logged.

## Manual installation

- Clone this repo inside:
  - **MacOS**: `~/Library/Application\ Support/Insomnia/plugins/`
  - **Windows**: `%APPDATA%\Insomnia\plugins\`
  - **Linux**: `$XDG_CONFIG_HOME/Insomnia/plugins/ or ~/.config/Insomnia/plugins/`
- Install dependencies using `npm i`

## Protecting User Privacy

Loggers always have an active set of <a href="https://resurface.io/logging-rules">rules</a> that control what data is logged
and how sensitive data is masked. All of the examples above apply a predefined set of rules (`include debug`),
but logging rules are easily customized to meet the needs of any application.

<a href="https://resurface.io/logging-rules">Logging rules documentation</a>

---
<small>&copy; 2016-2024 <a href="https://resurface.io">Graylog, Inc.</a></small>

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