As already shortly discussed in the call with @selzoc and other members of the capi team yesterday we would like to have an improvement on the logging of the cloud controller
Issue
In the log messages of the cloud controller there are customer IPs logged
Context
On the info log level the IPs of the request are contained in the log message.
However we are (by policy) not allow that customer IPs are logged and persisted for longer than 3 days. The problem we got now is that we want to keep the rest of the logs for a longer period than 3 days because of debugging reasons. There are a few possible solutions we came up with:
See possible fix section
Steps to Reproduce
See cloud controller request logs:
"Started DELETE "/v2/service_instances/XXXX?async=true" for user: XXXX, ip: 35.198.152.XX with vcap-request-id: XXX::XXX at 2020-02-19 13:36:49 UTC"
Expected result
Having the same logs without the IPs so they can be kept longer than 3 days.
Current result
Logs with customer IPs must be deleted after 3 days because of policy reasons
Possible Fix
- Remove IPs from logging in general
- Move IP logging from info to debug log level
- Remove the last octet from the IPs so that they are anonymous
- Config switch for enabling/disabling IP logging
Changes here could do the trick:
|
@logger.info( |
|
sprintf('Started %<method>s "%<path>s" for user: %<user>s, ip: %<ip>s with vcap-request-id: %<request_id>s at %<at>s', |
|
method: request.request_method, |
|
path: request.filtered_path, |
|
user: env['cf.user_guid'], |
|
ip: request.ip, |
|
request_id: env['cf.request_id'], |
|
at: Time.now.utc) |
As already shortly discussed in the call with @selzoc and other members of the capi team yesterday we would like to have an improvement on the logging of the cloud controller
Issue
In the log messages of the cloud controller there are customer IPs logged
Context
On the info log level the IPs of the request are contained in the log message.
However we are (by policy) not allow that customer IPs are logged and persisted for longer than 3 days. The problem we got now is that we want to keep the rest of the logs for a longer period than 3 days because of debugging reasons. There are a few possible solutions we came up with:
See possible fix section
Steps to Reproduce
See cloud controller request logs:
Expected result
Having the same logs without the IPs so they can be kept longer than 3 days.
Current result
Logs with customer IPs must be deleted after 3 days because of policy reasons
Possible Fix
Changes here could do the trick:
cloud_controller_ng/middleware/request_logs.rb
Lines 12 to 19 in 44e2d6c