Skip to content
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

Obfuscation, inclue, exlude properties couldn't set from configuration #445

Closed
ilkin opened this issue Feb 28, 2019 · 7 comments
Closed

Comments

@ilkin
Copy link

ilkin commented Feb 28, 2019

logbook-spring-boot-starter doesn't work correct due to some properties doesn't set.

Description

Obfuscate, inclue, exlude properties couldn't set from configuration due to LogbookProperties hasn't any setter methods for these properties. So LogbookAutoConfiguration gets empty configuration from LogbookProperties for obfuscate, include, exclude

Possible Fix

Add setter methods for obfuscate, include, exclude in LogbookProperties .

Context

Couldn't set logbook.obfuscate.headers, logbook.obfuscate.parameters, logbook.include, logbook.exclude from application.properties in Spring Boot project. Manually added logbook bean configured with java api.

Your Environment

  • Version used: 1.13.0
  • Spring Boot version: 1.5.2.RELEASE
@whiskeysierra
Copy link
Collaborator

Can you show your application.properties ?

@whiskeysierra
Copy link
Collaborator

I'm assuming you're running into the same issue as #282 and #370.

@ilkin
Copy link
Author

ilkin commented Mar 1, 2019

Can you show your application.properties ?

logbook.format.style=http
logbook.write.max-body-size=300
logbook.include=[/demo/**]
logbook.exclude=[/demo/monitor/**,/v2/api-docs,/configuration/ui,/swagger-resources,/configuration/security,/swagger-ui.html,/webjars/**]
logbook.filter.enabled=true
logbook.secure-filter.enabled=true
logbook.obfuscate.headers=[Authorization,x-auth-password,x-auth-token,X-Secret]
logbook.obfuscate.parameters=[access_token,password]

@whiskeysierra
Copy link
Collaborator

As I assumed, the problem is not with logbook but how spring represents lists in flat properties files. Either you use yaml or follow the suggestion in #282.
https://stackoverflow.com/a/47586180

@vineetgupta1991
Copy link

Can you try with the below format (without brackets) :

logbook.exclude=/demo/monitor/,/v2/api-docs,/configuration/ui,/swagger-resources,/configuration/security,/swagger-ui.html,/webjars/

It's working for me

@whiskeysierra
Copy link
Collaborator

I believe that depends on the Spring version.

@kedarjavalkar
Copy link

kedarjavalkar commented Aug 25, 2020

I had to do add below to my application.properties

logbook.exclude[0]=**/v2/api-docs
logbook.exclude[1]=**/swagger-ui.html
logbook.exclude[2]=**/webjars/**
logbook.exclude[3]=**/swagger-resources/**
logbook.exclude[4]=**/csrf
logbook.exclude[5]=**/

I am using

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>

Tip: Use logbook.write.max-body-size=10 until you are able to exclude needed urls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants