Log request and response data over UDP to Loggly.
Configuration Reference
This plugin is compatible with DB-less mode.
Example plugin configuration
Parameters
Here's a list of all the parameters which can be used in this plugin's configuration:
Form Parameter | Description |
---|---|
name
required Type: string |
The name of the plugin, in this case loggly . |
service.name or service.id
Type: string |
The name or ID of the service the plugin targets.
Set one of these parameters if adding the plugin to a service through the top-level /plugins endpoint.
Not required if using /services/SERVICE_NAME|SERVICE_ID/plugins . |
route.name or route.id
Type: string |
The name or ID of the route the plugin targets.
Set one of these parameters if adding the plugin to a route through the top-level /plugins endpoint.
Not required if using /routes/ROUTE_NAME|ROUTE_ID/plugins . |
consumer.name or consumer.id
Type: string |
The name or ID of the consumer the plugin targets.
Set one of these parameters if adding the plugin to a consumer through the top-level /plugins endpoint.
Not required if using /consumers/CONSUMER_NAME|CONSUMER_ID/plugins . |
enabled
Type: boolean Default value: true |
Whether this plugin will be applied. |
config.host
optional Type: string Default value: logs-01.loggly.com
|
The IP address or hostname of Loggly server. |
config.port
optional Type: integer Default value: 514
|
The UDP port to send data to on the Loggly server. |
config.key
required Type: string |
Loggly customer token. |
config.tags
optional Type: set of string elements Default value: kong
|
An optional list of tags to support segmentation and filtering of logs. |
config.timeout
optional Type: number Default value: 10000
|
An optional timeout in milliseconds when sending data to the Loggly server. |
config.successful_severity
optional Type: string Default value: info
|
An optional logging severity assigned to all the successful requests with a response
status code 400. Available options: |
config.client_errors_severity
optional Type: string Default value: info
|
An optional logging severity assigned to all the failed requests with a response
status code 400 or higher but less than 500. Available options: |
config.server_errors_severity
optional Type: string Default value: info
|
An optional logging severity assigned to all the failed requests with response status
code 500 or higher. Available options: |
config.log_level
optional Type: string Default value: info
|
An optional logging severity, any request with equal or higher severity will be
logged to Loggly. Available options: |
Log format
Every request is logged to the System log in SYSLOG standard, with the
with message
component formatted as described below.
Note: Make sure the Syslog daemon is running on the instance and it’s configured with the
logging level severity the same as or lower than the set config.log_level
for this plugin.
Every request is logged separately in a JSON object, separated by a new line \n
, with the following format:
{
"latencies": {
"request": 515,
"kong": 58,
"proxy": 457
},
"service": {
"host": "httpbin.org",
"created_at": 1614232642,
"connect_timeout": 60000,
"id": "167290ee-c682-4ebf-bdea-e49a3ac5e260",
"protocol": "http",
"read_timeout": 60000,
"port": 80,
"path": "/anything",
"updated_at": 1614232642,
"write_timeout": 60000,
"retries": 5,
"ws_id": "54baa5a9-23d6-41e0-9c9a-02434b010b25"
},
"request": {
"querystring": {},
"size": 138,
"uri": "/log",
"url": "http://localhost:8000/log",
"headers": {
"host": "localhost:8000",
"accept-encoding": "gzip, deflate",
"user-agent": "HTTPie/2.4.0",
"accept": "*/*",
"connection": "keep-alive"
},
"method": "GET"
},
"tries": [
{
"balancer_latency": 0,
"port": 80,
"balancer_start": 1614232668399,
"ip": "18.211.130.98"
}
],
"client_ip": "192.168.144.1",
"workspace": "54baa5a9-23d6-41e0-9c9a-02434b010b25",
"upstream_uri": "/anything",
"response": {
"headers": {
"content-type": "application/json",
"date": "Thu, 25 Feb 2021 05:57:48 GMT",
"connection": "close",
"access-control-allow-credentials": "true",
"content-length": "503",
"server": "gunicorn/19.9.0",
"via": "kong/2.2.1.0-enterprise-edition",
"x-kong-proxy-latency": "57",
"x-kong-upstream-latency": "457",
"access-control-allow-origin": "*"
},
"status": 200,
"size": 827
},
"route": {
"id": "78f79740-c410-4fd9-a998-d0a60a99dc9b",
"paths": [
"/log"
],
"protocols": [
"http"
],
"strip_path": true,
"created_at": 1614232648,
"ws_id": "54baa5a9-23d6-41e0-9c9a-02434b010b25",
"request_buffering": true,
"updated_at": 1614232648,
"preserve_host": false,
"regex_priority": 0,
"response_buffering": true,
"https_redirect_status_code": 426,
"path_handling": "v0",
"service": {
"id": "167290ee-c682-4ebf-bdea-e49a3ac5e260"
}
},
"started_at": 1614232668342
}
JSON object considerations
A few considerations on the JSON object:
request
contains properties about the request sent by the client.response
contains properties about the response sent to the client.tries
contains the list of (re)tries (successes and failures) made by the load balancer for this request.route
contains Kong Gateway properties about the specific Route requested.service
contains Kong Gateway properties about the Service associated with the requested Route.authenticated_entity
contains Kong Gateway properties about the authenticated credential (if an authentication plugin has been enabled).workspaces
contains Kong Gateway properties of the Workspaces associated with the requested Route. Only in Kong Gateway version >= 0.34.x. For Kong Gateway version >= 2.1.x, there is aws_id
on services and routes that reference the workspace ID.consumer
contains the authenticated Consumer (if an authentication plugin has been enabled).latencies
contains some data about the latencies involved:proxy
is the time it took for the final service to process the request.kong
is the internal Kong latency that it took to run all the plugins.request
is the time elapsed between the first bytes were read from the client and after the last bytes were sent to the client. Useful for detecting slow clients.
client_ip
contains the original client IP address.started_at
contains the UTC timestamp of when the request has started to be processed.
Log plugins enabled on services and routes contain information about the service or route.
Kong process errors
This logging plugin logs HTTP request and response data, and also supports streams data (TCP, TLS, and UDP).
If you are looking for the Kong process error file (which is the nginx error file), you can find it at the following path:
{prefix}/logs/error.log