Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(httplog) update for 3.0 changes #3929

Merged
merged 4 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/_hub/kong-inc/http-log/2.0.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ params:
- name: headers
required: false
default: empty table
datatype: array of string elements
datatype: table
description: |
An optional table of headers added to the HTTP message to the upstream server. The following
headers are not allowed: `Host`, `Content-Length`, `Content-Type`.
An optional table of headers added to the HTTP message to the upstream server.
The table contains arrays of values, indexed by the header name (multiple values per header).
The following headers are not allowed: `Host`, `Content-Length`, `Content-Type`.

**Note:** This parameter is only available for versions
2.3.x and later.
Expand Down
158 changes: 158 additions & 0 deletions app/_hub/kong-inc/http-log/2.1.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
name: HTTP Log
publisher: Kong Inc.
version: 2.1.x
desc: Send request and response logs to an HTTP server
description: |
Send request and response logs to an HTTP server.
type: plugin
categories:
- logging
kong_version_compatibility:
community_edition:
compatible:
- 2.8.x
- 2.7.x
- 2.6.x
- 2.5.x
- 2.4.x
enterprise_edition:
compatible:
- 2.8.x
- 2.7.x
- 2.6.x
- 2.5.x
- 2.4.x
params:
name: http-log
service_id: true
route_id: true
consumer_id: true
protocols:
- http
- https
- tcp
- tls
- tls_passthrough
- udp
- grpc
- grpcs
dbless_compatible: 'yes'
config:
- name: http_endpoint
required: true
default: null
value_in_examples: 'http://mockbin.org/bin/:id'
datatype: string
encrypted: true
description: The HTTP URL endpoint (including the protocol to use) to which the data is sent.
- name: method
required: false
default: '`POST`'
value_in_examples: POST
datatype: string
description: |
An optional method used to send data to the HTTP server. Supported values are
`POST` (default), `PUT`, and `PATCH`.
- name: content_type
required: false
default: '`application/json`'
value_in_examples: null
datatype: string
description: |
Indicates the type of data sent. The only available option is `application/json`.
- name: timeout
required: false
default: '`10000`'
value_in_examples: 1000
datatype: number
description: An optional timeout in milliseconds when sending data to the upstream server.
- name: keepalive
required: false
default: '`60000`'
value_in_examples: 1000
datatype: number
description: An optional value in milliseconds that defines how long an idle connection will live before being closed.
- name: flush_timeout
required: false
default: '`2`'
value_in_examples: 2
datatype: number
description: |
Optional time in seconds. If `queue_size` > 1, this is the max idle time before sending a log with less than `queue_size` records.
- name: retry_count
required: false
default: 10
value_in_examples: 15
datatype: integer
description: Number of times to retry when sending data to the upstream server.
- name: queue_size
required: false
default: 1
datatype: integer
description: Maximum number of log entries to be sent on each message to the upstream server.
- name: headers
required: false
default: empty table
datatype: table
description: |
An optional table of headers added to the HTTP message to the upstream server.
The table contains arrays of values, indexed by the header name (multiple values per header).
The following headers are not allowed: `Host`, `Content-Length`, `Content-Type`.

**Note:** This parameter is only available for versions
2.3.x and later.
- name: custom_fields_by_lua
required: false
default:
datatype: map
description: |
A list of key-value pairs, where the key is the name of a log field and
the value is a chunk of Lua code, whose return value sets or replaces
the log field value.
extra: |
**NOTE:** If the `config.http_endpoint` contains a username and password (for example,
`http://bob:password@example.com/logs`), then Kong Gateway automatically includes
a basic-auth `Authorization` header in the log requests.
---

## Log format

**Note:** If the `queue_size` argument > 1, a request is logged as an array of JSON objects.

{% include /md/plugins-hub/log-format.md %}

### JSON object considerations

{% include /md/plugins-hub/json-object-log.md %}


## Custom Headers

The log server that receives these messages might require extra headers, such as for authorization purposes.

```yaml
...
- name: http-log
config:
headers:
Authorization: "Bearer <token>"
...
```

## Kong process errors

{% include /md/plugins-hub/kong-process-errors.md %}

## Custom Fields by Lua

{% include /md/plugins-hub/log_custom_fields_by_lua.md %}

---

## Changelog

### 2.2.1

* Starting with {{site.base_gateway}} 2.7.0.0, if keyring encryption is enabled,
the `config.http_endpoint` parameter value will be encrypted.
17 changes: 8 additions & 9 deletions app/_hub/kong-inc/http-log/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: HTTP Log
publisher: Kong Inc.
version: 2.1.x
version: 3.0.x
desc: Send request and response logs to an HTTP server
description: |
Send request and response logs to an HTTP server.
Expand Down Expand Up @@ -96,15 +96,10 @@ params:
default: empty table
datatype: array of string elements
description: |
An optional table of headers added to the HTTP message to the upstream server. The following
headers are not allowed: `Host`, `Content-Length`, `Content-Type`.
An optional table of headers (value indexed by header name) added to the HTTP message to the
upstream server. The following headers are not allowed: `Host`, `Content-Length`, `Content-Type`.

**Note:** This parameter is only available for versions
2.3.x and later.
extra: |
**NOTE:** If the `config.http_endpoint` contains a username and password (for example,
`http://bob:password@example.com/logs`), then Kong Gateway automatically includes
a basic-auth `Authorization` header in the log requests.
**Note:** Before version 3.0.0 the values were arrays of strings (multiple values per header name)
- name: custom_fields_by_lua
required: false
default:
Expand All @@ -113,6 +108,10 @@ params:
A list of key-value pairs, where the key is the name of a log field and
the value is a chunk of Lua code, whose return value sets or replaces
the log field value.
extra: |
**NOTE:** If the `config.http_endpoint` contains a username and password (for example,
`http://bob:password@example.com/logs`), then Kong Gateway automatically includes
a basic-auth `Authorization` header in the log requests.
---

## Log format
Expand Down
1 change: 1 addition & 0 deletions app/_hub/kong-inc/http-log/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- release: 3.0.x
- release: 2.1.x
- release: 2.0.x
- release: 1.0.x
Expand Down