Skip to content

Customer IPs in Cloud Controller log messages #1568

@MMisoch

Description

@MMisoch

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions