wso2 / product-microgateway

Choreo Connect is a cloud-native, open-source, and developer-centric API gateway.
https://wso2.com/choreo/choreo-connect/
Apache License 2.0
293 stars 252 forks source link

Remove /health and /ready from Access Logs #3430

Closed renuka-fernando closed 1 year ago

renuka-fernando commented 1 year ago

Purpose

$subject

Config

[accessLogs.excludes]
[accessLogs.excludes.systemHost]
enabled = true
pathRegex = "^(/health|/ready)$" # keep this empty to match all paths

Docker Compose Tests

1. System Host /health

$ curl -X GET "https://localhost:9095/health" -H "accept: application/json" -H "Authorization:Bearer $TOKEN" -k
{"status": "healthy"}

No Access log printed.

2. Other Host /health

$ curl -X GET "https://localhost:9095/health" -H "accept: application/json" -H "Authorization:Bearer $TOKEN" -k -H 'Host: foo'
{"description":"The requested resource is not available.","code":"404","message":"Not Found"}
{"apiPath":null,"respTxDur":null,"respCode":404,"upstrmSvcTime":null,"respCodeDtls":"route_not_found","respDur":null,"bytesSent":94,"extAuthDtls":null,"dur":0,"respFlag":"NR","time":"2023-09-04T05:48:03.697Z","reqTxDur":null,"prot":"HTTP/1.1","upstrmHost":null,"bytesRecv":0,"reqDur":0,"ua":"curl/7.79.1","reqId":"b91f7d9b-8eb4-438c-8fed-eacb227011a8","method":"GET","gwHost":null,"xff":null,"host":"foo","apiUuid":null,"upstrmPath":"/health"}

3. System Host /health/foo/health

$ curl -X GET "https://localhost:9095/health/foo/health" -H "accept: application/json" -H "Authorization:Bearer $TOKEN" -k
{"description":"The requested resource is not available.","message":"Not Found","code":"404"}
{"respCodeDtls":"route_not_found","apiPath":null,"time":"2023-09-04T05:48:52.486Z","upstrmSvcTime":null,"reqDur":0,"respDur":null,"xff":null,"ua":"curl/7.79.1","bytesRecv":0,"extAuthDtls":null,"respFlag":"NR","reqId":"cead9a49-9fe7-4ebd-8895-f3804ca1237b","dur":0,"gwHost":null,"bytesSent":94,"respCode":404,"upstrmPath":"/health/foo/health","host":"localhost:9095","respTxDur":null,"reqTxDur":null,"upstrmHost":null,"prot":"HTTP/1.1","method":"GET","apiUuid":null}

4. System Host /token

curl -X POST "https://localhost:9095/testkey" -d "scope=read:pets" -H "Authorization: Basic YWRtaW46YWRtaW4=" -k -v
{"upstrmSvcTime":null,"respTxDur":0,"extAuthDtls":null,"reqId":"22b2a953-e0ba-40f6-86a1-e28d9e97a7ee","prot":"HTTP/1.1","method":"POST","bytesRecv":15,"apiUuid":null,"bytesSent":762,"xff":null,"ua":"curl/7.79.1","respFlag":"-","respCodeDtls":"via_upstream","host":"enforcer","upstrmPath":"/testkey","reqDur":0,"respDur":108,"gwHost":null,"upstrmHost":"172.30.0.4:9001","dur":108,"apiPath":null,"time":"2023-09-04T06:07:49.854Z","reqTxDur":36,"respCode":200}

5. Invoke API

curl -X GET "https://localhost:9095/v2/pet/findByStatus?status=pending" -H "accept: application/json" -H "Authorization:Bearer $TOKEN" -k
{"dur":2006,"bytesRecv":0,"upstrmHost":"185.42.117.109:443","reqId":"781d3001-7d47-4989-a2fa-767f095c1229","respFlag":"-","reqDur":0,"upstrmPath":"/v3/9ec5a57e-733c-4338-9854-7ea31866dcba/pet/findByStatus?status=pending","extAuthDtls":null,"reqTxDur":1845,"respCodeDtls":"via_upstream","respDur":2005,"respCode":200,"prot":"HTTP/1.1","bytesSent":31,"apiPath":"/v2/pet/findByStatus?status=pending","gwHost":"localhost:9095","ua":"curl/7.79.1","apiUuid":"648957e7a675c35145393369","upstrmSvcTime":null,"method":"GET","host":"run.mocky.io","time":"2023-09-04T06:08:54.093Z","xff":null,"respTxDur":0}

Issues

Fixes #

Automation tests

Tested environments

Tested in Docker Compose


Maintainers: Check before merge

choreo-cicd commented 1 year ago

[succeeded] Dataplane(EastUS) cluster : dev-deployment-v2 : 20230905.39

choreo-cicd commented 1 year ago

[succeeded] : dev-deployment-v2 : 20230905.39

choreo-cicd commented 1 year ago

[succeeded] Dataplane(NorthEU) cluster : dev-deployment-v2 : 20230905.39

choreo-cicd commented 1 year ago

[succeeded] Controlplane cluster : dev-deployment-v2 : 20230905.39

choreo-cicd commented 1 year ago

[succeeded] Dataplane(NorthEU) cluster : prod-deployment-v2 : 20230907.5

choreo-cicd commented 1 year ago

[succeeded] Controlplane cluster : prod-deployment-v2 : 20230907.5