Comments (6)
Hi @samugi ! Thanks for answering 😄
Unfortunately, the KONG_NGINX_HTTP_LOG_FORMAT
does not work for us, cause it is being used to set the log format, but it does not allow setting the if=
directive 😞 .
Basically, we would like to apply the following Nginx configuration to ensure that 2xx and 3xx requests aren't logged:
map $status $loggable {
~^[23] 0;
default 1;
}
access_log /dev/stdout combined if=$loggable;
This was achievable before (Kong <3.5) by setting KONG_PROXY_ACCESS_LOG="/dev/stdout combined if=$loggable"
, but now this is not possible cause:
- The code forces to put the
kong_log_format
at the end of the line. - The only way to bypass this is by setting
KONG_PROXY_ACCESS_LOG=<file> <format>
. Otherwise, the string does not match this regex and the code puts thekong_log_format
at the end of the line.
Many thanks!
from kong.
Hi again 👋
I found the root problem. I was using the kong docker image (kong:3.5
) and I thought that it was using Kong 3.5.0.2 (kong version
returns Kong 3.5). After replacing the image by the kong/kong-gateway:3.5.0.2
the issue is solved!!
Many thanks for your help 🙏
from kong.
I've reviewed the code and the affected line was changed here feat(request-id): introduce unique Request ID
from kong.
Hi @alemuro thank you for reporting this. I am looking into the issue you described, in the meantime, could you check if the problem is resolved by using the KONG_NGINX_HTTP_LOG_FORMAT
variable to set the log format? Thank you.
from kong.
Hi @alemuro and thank you for the additional details provided.
I was able to reproduce the problem on 3.5.0.0
, but I believe that should've been fixed by #12073, in fact, the regex you linked should match the string /dev/stdout combined if=$loggable
. To make sure, I tested this on kong/kong-gateway:3.5.0.2-ubuntu
and got the expected result, where conditional logging using the if
keyword is accepted. Using your filter, the conditional logging was applied correctly to only log "non 2xx/3xx" status codes.
Can you try with the image I tested and let me know, and in case the problem can still be reproduced, provide some steps that include the exact image you are testing with? Thank you!
from kong.
thank you @alemuro !
from kong.
Related Issues (20)
- Memory usage of kong with DBless more keeps increasing. HOT 3
- Dev Portal: selection of Category Filter is not intuitive HOT 1
- `kong_request_latency_ms` should follow the service or route life cycle
- Kong KIC fails when rate-limiting plugin config.policy is set to cluster HOT 3
- Kong breaks cert-manager certificate creation HOT 12
- db_import with keyauth_credentials fails on re-run HOT 9
- Kong returns 503 error to api-client due to failure in DNS resolution of upstream service HOT 7
- Kong Manager in Kong OSS HOT 1
- REF: A question with cti. Yugabyte issue #12314 HOT 1
- Opentelemetry - span name is Kong HOT 3
- Nil entity returned when using dao select statement on Kong 3.3 Postgres
- 100% CPU usage and keep posting event 'reset_instances' to go plugin server HOT 1
- 100% CPU usage and keep posting event 'reset_instances' to go plugin server HOT 11
- failed to connect: ssl set client certificate failed
- kong can't start by `xpcall` HOT 3
- large discrepancy between request_time and upstream_response_time HOT 4
- "declarative_config.lua:654: table index is nil" with custom lua plugin (via configmap)
- Bug when triggering renewal of cert in acme plugin HOT 4
- when sending "%5C" in the url, kong response with 400 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kong.