Logs request and response data to Runscope. Using the Runscope Traffic Inspector, each proxied request can be fully viewed in it's entirety. All traffic can be searched by keyword (headers and bodies are indexed) and attribute (i.e. status code, response size, response time, etc.). Using Runscope Live Traffic Alerts, failures and exceptions during requests can be caught, notifying your team about problems before your customers find out. Trigger alerts based on any part of the HTTP request or response, including header values, JSON or XML data, connection details and more. Alerts can be sent to Slack, HipChat, PagerDuty, email, or webhook notifications. Live Traffic Alerts is available on all medium and larger plans.


Terminology

  • plugin: a plugin executing actions inside Kong before or after a request has been proxied to the upstream API.
  • Service: the Kong entity representing an external upstream API or microservice.
  • Route: the Kong entity representing a way to map downstream requests to upstream services.
  • Consumer: the Kong entity representing a developer or machine using the API. When using Kong, a Consumer only communicates with Kong which proxies every call to the said upstream API.
  • Credential: a unique string associated with a Consumer, also referred to as an API key.
  • upstream service: this refers to your own API/service sitting behind Kong, to which client requests are forwarded.
  • API: a legacy entity used to represent your upstream services. Deprecated in favor of Services since 0.13.0.

Configuration

Enabling the plugin on a Service

Configure this plugin on a Service by making the following request:

$ curl -X POST http://kong:8001/services/{service}/plugins \
    --data "name=runscope"  \
    --data "config.access_token=YOUR_ACCESS_TOKEN" \
    --data "config.bucket_key=YOUR_BUCKET_KEY"
  • service: the id or name of the Service that this plugin configuration will target.

Enabling the plugin on a Route

Configure this plugin on a Route with:

$ curl -X POST http://kong:8001/routes/{route_id}/plugins \
    --data "name=runscope"  \
    --data "config.access_token=YOUR_ACCESS_TOKEN" \
    --data "config.bucket_key=YOUR_BUCKET_KEY"
  • route_id: the id of the Route that this plugin configuration will target.

Enabling the plugin on a Consumer

You can use the http://localhost:8001/plugins endpoint to enable this plugin on specific Consumers:

$ curl -X POST http://kong:8001/plugins \
    --data "name=runscope" \
    --data "consumer_id={consumer_id}"  \
    --data "config.access_token=YOUR_ACCESS_TOKEN" \
    --data "config.bucket_key=YOUR_BUCKET_KEY"

Where consumer_id is the id of the Consumer we want to associate with this plugin.

You can combine consumer_id and service_id

in the same request, to futhermore narrow the scope of the plugin.

Enabling the plugin on an API

If you are using an older version of Kong with the legacy API entity (deprecated since 0.13.0), you can configure this plugin on top of such an API by making the following request:

$ curl -X POST http://kong:8001/apis/{api}/plugins \
    --data "name=runscope"  \
    --data "config.access_token=YOUR_ACCESS_TOKEN" \
    --data "config.bucket_key=YOUR_BUCKET_KEY"
  • api: either id or name of the API that this plugin configuration will target.

Global plugins

All plugins can be configured using the http://kong:8001/plugins/ endpoint. A plugin which is not associated to any Service, Route or Consumer (or API, if you are using an older version of Kong) is considered "global", and will be run on every request. Read the Plugin Reference and the Plugin Precedence sections for more information.

Parameters

Here's a list of all the parameters which can be used in this plugin's configuration:

form parameterdefaultdescription
nameThe name of the plugin to use, in this case runscope
service_idThe id of the Service which this plugin will target.
route_idThe id of the Route which this plugin will target.
enabledtrueWhether this plugin will be applied.
consumer_idThe id of the Consumer which this plugin will target.
api_idThe id of the API which this plugin will target. Note: The API Entity is deprecated since Kong 0.13.0.
config.access_token

The Runscope access token (or personal access token) for the Runscope API.

config.bucket_key

Your Runscope bucket ID where traffic data will be stored.

config.log_body
optional

false

Whether or not the request and response bodies should be sent to Runscope.

config.api_endpoint
optional

https://api.runscope.com

URL for the Runscope API.

config.timeout
optional

10000

An optional timeout in milliseconds when sending data to Runscope.

config.keepalive
optional

30

An optional value in milliseconds that defines for how long an idle connection will live before being closed.

How it works

This plugin sends traffic data for each call proxied through a Service/Route (or deprecated API entity) using the Runscope API.

It is important to be aware of performance when configuring this plugin. For example, be aware that logging the request and response bodies might slow down your traffic if your service is under heavy load. If your service expects significantly large request or response bodies, consider turning off this feature by updating the log_body configuration.


Kong Process Errors

This logging plugin will only log HTTP request and response data. If you are looking for the Kong process error file (which is the nginx error file), then you can find it at the following path: {prefix}/logs/error.log

Keep up with the latest features