Skip to content

Latest commit

 

History

History
171 lines (152 loc) · 4.47 KB

README.md

File metadata and controls

171 lines (152 loc) · 4.47 KB

Kong http log advanced

Send request and response logs to multiple HTTP servers. With many configuration + body

Installation

WIP

Configuration

You can add the plugin on top of an API by executing the following request on your Kong server:

$ http POST :8001/services/{api}/plugins name=middleman-advanced config:='{ "services": [{"url": "http://myserver.io/validate", "timeout": 10000, "keepalive": 60000}]}'
form parameter default description
name The name of the plugin to use, in this case: middleman
config.services
required
The list of services witch the plugin make a JSON POST

Service config

form parameter default description
url
required
The URL to which the plugin will make a JSON POST request before proxying the original request.
timeout 10000 Timeout (miliseconds) for the request to the URL specified above. Default value is 10000.
keepalive 60000 Keepalive time (miliseconds) for the request to the URL specified above. Default value is 60000.
include_cert false Include the original certificate in JSON POST
include_credential false Include the credential in JSON POST
include_consumer false Include the consumer in JSON POST
include_route false Include the route in JSON POST

Middleman will execute a JSON POST request to the specified url with the following body:

Payload

local payload = {
    ['certificate'] = certificate,
    ['consumer'] = consumer,
    ['credential'] = credential,
    ['kong_routing'] = kong_routing,
    ['message'] = message,
    ['request'] = {
      ['headers'] = headers,
      ['params'] = params,
      ['body'] = json_body,
    }
  }
Attribute Description
certificate The certificate of the original request if include_credential
see resty_kong_tls.get_full_client_certificate_chain()
consumer The consumer of the original request
see kong.client.get_consumer()
credential The consumer of the original request
see kong.client.get_credential()
kong_routing The kong_routing of the original request
see kong.router.get_route() and kong.router.get_service()
request The request of the original request
see the next table : request
message The original log send by kong
see basic_serializer.serialize(ngx)

Request

Attribute Description
body The body of the original request
params The url arguments of the original request
headers The headers of the original request

Author

David TOUZET

License

The MIT License (MIT)
=====================

Copyright (c) 2020-2021 David TOUZET

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.