-
Notifications
You must be signed in to change notification settings - Fork 725
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
logutil, *: implement log desensitization #3011
Conversation
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
BTW, I think there are more logs which need to be handled. |
server/config/config.go
Outdated
@@ -144,6 +144,8 @@ type Config struct { | |||
Dashboard DashboardConfig `toml:"dashboard" json:"dashboard"` | |||
|
|||
ReplicationMode ReplicationModeConfig `toml:"replication-mode" json:"replication-mode"` | |||
// EnableRedactLog indicates that whether redact log, 0 is disable. 1 is enable. | |||
EnableRedactLog int32 `toml:"enable-redact-log" json:"enable-redact-log"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep the same behavior with tidb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They use int32 because they need to do atomic operations but we don't. I think we don't have to follow them.
After discussion, only start-key and end-key of the region need to be redacted in the log. @rleungx |
Does |
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
pkg/logutil/log.go
Outdated
} | ||
|
||
// RedactBytesArgIfNeeded receives []byte argument and return omitted information if redact log enabled | ||
func RedactBytesArgIfNeeded(arg []byte) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks verbose. How about just RedactBytes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using a function like func ZapRedact(key string, val interface{}) zap.Field
?
Signed-off-by: Song Gao <disxiaofei@163.com>
good idea. |
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
/run-all-tests |
/cherry-picker |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #3266 |
* cherry pick #3011 to release-4.0 Signed-off-by: ti-srebot <ti-srebot@pingcap.com> * fix conflict Signed-off-by: Song Gao <disxiaofei@163.com> * fix conflict Signed-off-by: Song Gao <disxiaofei@163.com> Co-authored-by: Song Gao <disxiaofei@163.com> Co-authored-by: Ti Prow Robot <71242396+ti-community-prow-bot@users.noreply.github.com>
What problem does this PR solve?
close #2852
Implement log desensitization to omit the region key information from the log.
What is changed and how it works?
Check List
Tests
Code changes
Related changes
pingcap/docs
/pingcap/docs-cn
:Release note
enable-redact-log
to enable log desensitization or not.