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)
- Database migration failed while using helm chart HOT 2
- JWT Plugin bypasses validation process occasionally on frequent requests HOT 4
- TLS SNI Route not work HOT 7
- Kong info, notice, inspect logs are all getting logged as error in GCP(google cloud platform) HOT 3
- Cannot use kong.db HOT 1
- http-log plugin: Host header not including port HOT 3
- Every time request localhost:8001/metrics, kong-cp-kong-pod will prompt a license-related error HOT 3
- Dataplane not getting information from the ControlPlane in Hybrid mode HOT 3
- go plugin error, worker-events: event callback failed; source=plugin_server, event=reset_instance HOT 1
- Error: attempt to index local 'ssl' (a nil value) for Kong >= 3.6.0 when KONG_PG_SSL=on HOT 6
- Handling two JWT signing keys for same iss
- Documentation Improvement - Clarify Plugin Compatibility with Kong Versions](https://github.com/Kong/kong/issues/9999 HOT 1
- Error "error loading plugin schemas: on plugin <my-plugin>: <my-plugin> plugin is enabled but not installed" with Python plugin for kong HOT 5
- Where is kong 3.7.0 container image ? Can't find it on Dockerhub HOT 2
- Hola
- Inconsistent Rate Limiting Behavior Under High Load HOT 1
- No ability in plugin schema to have a record with dynamic fields HOT 2
- Changelog md no longer maintained? HOT 2
- Odd Kong startup errors post 2.8.x to 3.7.0 upgrade HOT 5
- Kong can't match routes correctly with the same hosts, paths, and different protocols in the route. HOT 4
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.