-
Notifications
You must be signed in to change notification settings - Fork 264
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
How can i disbale to log default params & can i rename "correlation" field #1029
Comments
You can obfuscate headers by setting a spring-boot property:
see: https://github.com/zalando/logbook#configuration I think customization of fields logged and field names can be done by implementing and registering a custom https://github.com/zalando/logbook/blob/main/logbook-api/src/main/java/org/zalando/logbook/Strategy.java |
Not quite. If you want to re-use most of the json mechanics, then a custom Take a look at the javadoc for logbook/logbook-json/src/main/java/org/zalando/logbook/json/JsonHttpLogFormatter.java Lines 18 to 49 in 846fd53
|
Within those |
Feel free to re-open, if this doesn't suite your needs. |
Thanks i will take a look next week ! |
Hi,
currently i just getting started with the lib in a spring-boot project. I just added the starter to pom and found a way to replace the value of my correlation via using a bean. nice... but, can i also overwrite the field name? i would like to call it tracking_id instead of correlation?
Secondly, is there a way to turn of default log fields like "origin" "type" etc?
This is how my log statment looks like currently:
2021 - 05 - 11 13: 17: 09.954 TRACE 12532-- - [nio - 8082 - exec - 2]org.zalando.logbook.Logbook: { "origin": "remote", "type": "request", "correlation": "de1d86d9-f59e-4e11-b1bf-e5f4b569900c", "protocol": "HTTP/1.1", "remote": "0:0:0:0:0:0:0:1", "method": "POST", "uri": "http://localhost:8082/api/v1/dummy", "host": "localhost", "path": "/api/v1/dummy", "scheme": "http", "port": "8082", "headers": { "accept": ["*/*"], "accept-encoding": ["gzip, deflate, br"], "authorization": ["XXX"], "connection": ["keep-alive"], "content-length": ["27"], "content-type": ["application/json"], "host": ["localhost:8082"], "postman-token": ["750b3646-839c-4593-a50b-83d428942458"], "user-agent": ["PostmanRuntime/7.28.0"] }, "body": { "name": "Dummy" } }
edit: found this in you docs:
Logbook logbook = Logbook.builder() .condition(exclude( requestTo("/health"), requestTo("/admin/**"), contentType("application/octet-stream"), header("X-Secret", newHashSet("1", "true")::contains))) .build();
seems like you can exclude a header "x-secret" via code.. since i am currently just using the spring properties file, is there a way as well or am i mistaken?
The text was updated successfully, but these errors were encountered: