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

Allow specifying a different management access log prefix #43434

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mpalourdio
Copy link
Contributor

@mpalourdio mpalourdio commented Dec 6, 2024

Hi,

This a WIP in order to try to tackle GH-14948, GH-24170 for example.
It's today very common to handle logs in stdout, regarding k8s and such 'cloud' platforms., ie

server:
 tomcat:
    accesslog:
      enabled: true
      directory: /dev
      prefix: stdout
      suffix:

It's also reassuring (for SEC) to make actuator available on another port. Wrong properties can easily leak and bad things may happen.

This is just a draft to see if this could be an answer in order to have the ability to disable the access logs prefix while using actuator on an other port. Most companies that put logs in stdout can easily filter logs with tools like Splunk, so putting all those logs in the same output is not a problem at all.

The idea is to add a property to disable access logs prefix for actuator. Default is true to keep BC

management.server.accesslog-prefix=false

Is this the good direction?

Thanks

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 6, 2024
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch 3 times, most recently from 37d1c1c to 3e42a5e Compare December 7, 2024 19:15
Copy link
Contributor

@mhalbritter mhalbritter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @mpalourdio,

thanks for the PR. I've added some comments for your consideration.

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Dec 10, 2024
@mhalbritter mhalbritter changed the title feat: Add ability to disable access log prefix for management logs Add property to configure prefix for management access logs Dec 10, 2024
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch from 3e42a5e to 14537d7 Compare December 10, 2024 16:42
@mpalourdio
Copy link
Contributor Author

mpalourdio commented Dec 10, 2024

@mhalbritter I have forced-pushed with your suggestion. I have also taken care of Undertow and Jetty

I have built the source locally, and I have tested the property.
Both management.server.accesslog-prefix= && management.server.accesslog-prefix=whatever do the job (at least in tomcat)

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 10, 2024
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch 2 times, most recently from 935fa09 to c470bbd Compare December 10, 2024 17:23
@mpalourdio
Copy link
Contributor Author

mpalourdio commented Dec 10, 2024

Just wondering if it would not be better to create an inner AccessLog class in ManagementServerProperties so the property would be more in sync with server.tomcat.accesslog.prefix, and could handle further configuration properties. WDYT?

It just feels a bit weird to configure like this, no ?

server.tomcat.accesslog.prefix=stdout
management.server.accesslog-prefix=

@mhalbritter
Copy link
Contributor

Yes, we should add an Accesslog inner class to ManagementServerProperties like you suggested.

There's already a server.tomcat.accesslog.prefix which is by default set to access_log. Right now, what happens if I set management.server.accesslog-prefix=management_, i'll end up with an management access log which is named management_access_log because server.tomcat.accesslog.prefix is prefixed with management.server.accesslog-prefix. I wonder if it would be clearer if management.server.accesslog-prefix would override server.tomcat.accesslog.prefix completely.

So to get a management access log called management_access_log, i'd have to set management.server.accesslog-prefix=management_access_log. That would work regardless of the value of the server.tomcat.accesslog.prefix property.

@mhalbritter mhalbritter added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 11, 2024
@mpalourdio
Copy link
Contributor Author

Yes, we should add an Accesslog inner class to ManagementServerProperties like you suggested.

right, will give this a shot

There's already a server.tomcat.accesslog.prefix which is by default set to access_log. Right now, what happens if I set management.server.accesslog-prefix=management_, i'll end up with an management access log which is named management_access_log because server.tomcat.accesslog.prefix is prefixed with management.server.accesslog-prefix. I wonder if it would be clearer if management.server.accesslog-prefix would override server.tomcat.accesslog.prefix completely.

So to get a management access log called management_access_log, i'd have to set management.server.accesslog-prefix=management_access_log. That would work regardless of the value of the server.tomcat.accesslog.prefix property.

That behavior seems counter-intuitive to me. If you have already tweaked server.tomcat.accesslog.prefix for any reason, and then you add this new property, (so you remove server.tomcat.accesslog.prefix because it has become useless), then you decide to remove actuator from your project you would have to reconfigure the tomcat prefix etc.

IMO with this new property, it's good as is without any user intervention and does the only job it's made for.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 11, 2024
@mhalbritter mhalbritter added the for: team-attention An issue we'd like other members of the team to review label Dec 11, 2024
@mhalbritter
Copy link
Contributor

Flagging this to see what the team thinks about this:

There's already a server.tomcat.accesslog.prefix which is by default set to access_log. Right now, what happens if I set management.server.accesslog-prefix=management_, i'll end up with an management access log which is named management_access_log because server.tomcat.accesslog.prefix is prefixed with management.server.accesslog-prefix. I wonder if it would be clearer if management.server.accesslog-prefix would override server.tomcat.accesslog.prefix completely.

So to get a management access log called management_access_log, i'd have to set management.server.accesslog-prefix=management_access_log. That would work regardless of the value of the server.tomcat.accesslog.prefix property.

@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Dec 11, 2024
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch from c470bbd to cc20f8a Compare December 11, 2024 17:13
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch from cc20f8a to 86f1af1 Compare December 11, 2024 17:23
@mpalourdio mpalourdio force-pushed the actuatoraccesslogsprefix branch from 86f1af1 to b7a737e Compare December 11, 2024 17:56
@mhalbritter mhalbritter added type: enhancement A general enhancement for: merge-with-amendments Needs some changes when we merge and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Dec 12, 2024
@mhalbritter mhalbritter added this to the 3.5.x milestone Dec 12, 2024
@mhalbritter mhalbritter changed the title Add property to configure prefix for management access logs Allow specifying a different management access log prefix Dec 12, 2024
@mpalourdio
Copy link
Contributor Author

mpalourdio commented Dec 20, 2024

Hi, i see this targets 3.5.x milestone. Will this land in further 3.3.next (if any) and 3.4.next ? It's BC and the code has not moved from 3.2.X AFAIK.
Thanks for feedback.

@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 20, 2024

Hi - this is labeled as an enhancement, and enhancements are put in minor/major versions only, not in the maintenance one. That means this feature will land in Spring Boot 3.5.0 the earliest. 3.3 and 3.4 will not get that feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: merge-with-amendments Needs some changes when we merge type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants