insomnia-plugin-usage-logger

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

Usage no npm install needed!

<script type="module">
  import insomniaPluginUsageLogger from 'https://cdn.skypack.dev/insomnia-plugin-usage-logger';
</script>

README

Resurface Insomnia Plugin

Log API requests and responses made with Insomnia to your own system of record.

Requirements

Set up

  • Go to Insomnia > Preferences > Plugins, type in insomnia-plugin-usage-logger and click Install Plugin.

(Alternatively, check out the manual installation.)

  • Create a new Environment to store the variables used by the logger.

That's it!

Usage

  • Make sure to select the environment you created before (also, make sure the plugin is enabled).
  • Use Insomnia as you would normally.
  • Go to http://localhost:7700 to explore all your logs using the included API Explorer

Happy loggin' 📝

Environment variables

This plugin has access to three 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 docker container

The environment variable USAGE_LOGGERS_URL stores this address, which by default should be http://localhost:7701/message

✔ All API calls are filtered using a set of rules (Optional)

The environment variable USAGE_LOGGERS_RULES stores these rules. Learn more

✔ What if I want to disable the Logger? (Optional)

You can! By setting the environment variable USAGE_LOGGERS_DISABLE to true the logger will be disabled and no API calls will be logged.

In addition, if you're not using any other environment variables, you can just disable the environment and no API calls will be logged until you select the environment again.

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 rules 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.

Logging rules documentation


© 2016-2022 Resurface Labs Inc.