{"action":"created","issue":{"url":"https://api.github.com/repos/DataDog/dd-agent/issues/2146","labels_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2146/labels{/name}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2146/comments","events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2146/events","html_url":"https://github.com/DataDog/dd-agent/pull/2146","id":122304317,"number":2146,"title":"[core] do not log API keys","user":{"login":"yannmh","id":5708089,"avatar_url":"https://avatars.githubusercontent.com/u/5708089?v=3","gravatar_id":"","url":"https://api.github.com/users/yannmh","html_url":"https://github.com/yannmh","followers_url":"https://api.github.com/users/yannmh/followers","following_url":"https://api.github.com/users/yannmh/following{/other_user}","gists_url":"https://api.github.com/users/yannmh/gists{/gist_id}","starred_url":"https://api.github.com/users/yannmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yannmh/subscriptions","organizations_url":"https://api.github.com/users/yannmh/orgs","repos_url":"https://api.github.com/users/yannmh/repos","events_url":"https://api.github.com/users/yannmh/events{/privacy}","received_events_url":"https://api.github.com/users/yannmh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DataDog/dd-agent/labels/core","name":"core","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"yannmh","id":5708089,"avatar_url":"https://avatars.githubusercontent.com/u/5708089?v=3","gravatar_id":"","url":"https://api.github.com/users/yannmh","html_url":"https://github.com/yannmh","followers_url":"https://api.github.com/users/yannmh/followers","following_url":"https://api.github.com/users/yannmh/following{/other_user}","gists_url":"https://api.github.com/users/yannmh/gists{/gist_id}","starred_url":"https://api.github.com/users/yannmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yannmh/subscriptions","organizations_url":"https://api.github.com/users/yannmh/orgs","repos_url":"https://api.github.com/users/yannmh/repos","events_url":"https://api.github.com/users/yannmh/events{/privacy}","received_events_url":"https://api.github.com/users/yannmh/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/DataDog/dd-agent/milestones/54","html_url":"https://github.com/DataDog/dd-agent/milestones/5.7.0","labels_url":"https://api.github.com/repos/DataDog/dd-agent/milestones/54/labels","id":1360063,"number":54,"title":"5.7.0","description":null,"creator":{"login":"remh","id":1311477,"avatar_url":"https://avatars.githubusercontent.com/u/1311477?v=3","gravatar_id":"","url":"https://api.github.com/users/remh","html_url":"https://github.com/remh","followers_url":"https://api.github.com/users/remh/followers","following_url":"https://api.github.com/users/remh/following{/other_user}","gists_url":"https://api.github.com/users/remh/gists{/gist_id}","starred_url":"https://api.github.com/users/remh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remh/subscriptions","organizations_url":"https://api.github.com/users/remh/orgs","repos_url":"https://api.github.com/users/remh/repos","events_url":"https://api.github.com/users/remh/events{/privacy}","received_events_url":"https://api.github.com/users/remh/received_events","type":"User","site_admin":false},"open_issues":48,"closed_issues":9,"state":"open","created_at":"2015-10-16T19:06:06Z","updated_at":"2015-12-15T16:01:09Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-12-15T16:01:09Z","updated_at":"2015-12-15T20:14:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-agent/pulls/2146","html_url":"https://github.com/DataDog/dd-agent/pull/2146","diff_url":"https://github.com/DataDog/dd-agent/pull/2146.diff","patch_url":"https://github.com/DataDog/dd-agent/pull/2146.patch"},"body":"Create a `utils.logger` module:\r\n* Move `log_exceptions` from `utils.debug`\r\n* `NoAPIKeyLogRecord` is a custom `LogRecord` that obfuscates API keys\r\n  logging"},"comment":{"url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments/164883896","html_url":"https://github.com/DataDog/dd-agent/pull/2146#issuecomment-164883896","issue_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2146","id":164883896,"user":{"login":"yannmh","id":5708089,"avatar_url":"https://avatars.githubusercontent.com/u/5708089?v=3","gravatar_id":"","url":"https://api.github.com/users/yannmh","html_url":"https://github.com/yannmh","followers_url":"https://api.github.com/users/yannmh/followers","following_url":"https://api.github.com/users/yannmh/following{/other_user}","gists_url":"https://api.github.com/users/yannmh/gists{/gist_id}","starred_url":"https://api.github.com/users/yannmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yannmh/subscriptions","organizations_url":"https://api.github.com/users/yannmh/orgs","repos_url":"https://api.github.com/users/yannmh/repos","events_url":"https://api.github.com/users/yannmh/events{/privacy}","received_events_url":"https://api.github.com/users/yannmh/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T20:14:15Z","updated_at":"2015-12-15T20:14:15Z","body":"@remh,\r\nIn this case `record.msg` returns the log message template, i.e `u\"Sending %s to endpoint %s at %s\"`. While `record.getMessage()` would return the formatted message,  there is no setter to change it. \r\n\r\nSo to obfuscate the API key, there would be two options\r\n\r\n1. Iterate over the `record` parameters to obfuscate API keys if found. It's slow and not elegant (same approach was done in the decorator approch)\r\n2. Override `record.getMessage()` method, which is what is done with the custom `LogRecord ` approach."}}