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 will be transmitted to Loggly in SYSLOG standard, with message
component in the following format:
{
"request": {
"method": "GET",
"uri": "/get",
"url": "http://httpbin.org:8000/get",
"size": "75",
"querystring": {},
"headers": {
"accept": "*/*",
"host": "httpbin.org",
"user-agent": "curl/7.37.1"
}
},
"upstream_uri": "/",
"response": {
"status": 200,
"size": "434",
"headers": {
"Content-Length": "197",
"via": "kong/0.3.0",
"Connection": "close",
"access-control-allow-credentials": "true",
"Content-Type": "application/json",
"server": "nginx",
"access-control-allow-origin": "*"
}
},
"tries": [
{
"state": "next",
"code": 502,
"ip": "127.0.0.1",
"port": 8000
},
{
"ip": "127.0.0.1",
"port": 8000
}
],
"authenticated_entity": {
"consumer_id": "80f74eef-31b8-45d5-c525-ae532297ea8e",
"id": "eaa330c0-4cff-47f5-c79e-b2e4f355207e"
},
"route": {
"created_at": 1521555129,
"hosts": null,
"id": "75818c5f-202d-4b82-a553-6a46e7c9a19e",
"methods": null,
"paths": [
"/example-path"
],
"preserve_host": false,
"protocols": [
"http",
"https"
],
"regex_priority": 0,
"service": {
"id": "0590139e-7481-466c-bcdf-929adcaaf804"
},
"strip_path": true,
"updated_at": 1521555129
},
"service": {
"connect_timeout": 60000,
"created_at": 1521554518,
"host": "example.com",
"id": "0590139e-7481-466c-bcdf-929adcaaf804",
"name": "myservice",
"path": "/",
"port": 80,
"protocol": "http",
"read_timeout": 60000,
"retries": 5,
"updated_at": 1521554518,
"write_timeout": 60000
},
"workspaces": [
{
"id":"b7cac81a-05dc-41f5-b6dc-b87e29b6c3a3",
"name": "default"
}
],
"consumer": {
"username": "demo",
"created_at": 1491847011000,
"id": "35b03bfc-7a5b-4a23-a594-aa350c585fa8"
},
"latencies": {
"proxy": 1430,
"kong": 9,
"request": 1921
},
"client_ip": "127.0.0.1",
"started_at": 1433209822425
}
A few considerations on the above JSON object:
request
contains properties about the request sent by the clientresponse
contains properties about the response sent to the clienttries
contains the list of (re)tries (successes and failures) made by the load balancer for this requestroute
contains Kong properties about the specific Route requestedservice
contains Kong properties about the Service associated with the requested Routeauthenticated_entity
contains Kong properties about the authenticated credential (if an authentication plugin has been enabled)workspaces
contains Kong properties of the Workspaces associated with the requested Route. Only in Kong Gateway version >= 0.34.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 requestkong
is the internal Kong latency that it took to run all the pluginsrequest
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 addressstarted_at
contains the UTC timestamp of when the API transaction has started to be processed.
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