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

*: add mark function for log desensitization #8306

Merged
merged 8 commits into from
Jul 1, 2024

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Jun 18, 2024

What problem does this PR solve?

Issue Number: ref #8305.

What is changed and how does it work?

Provide sensitive log redact marker `‹..›` to customize log desensitization.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test
image

Release note

Provide sensitive log redact marker `‹..›` to customize log desensitization.

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2024
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 84.70588% with 13 lines in your changes missing coverage. Please review.

Project coverage is 77.37%. Comparing base (e7c9d15) to head (0a4f215).

Current head 0a4f215 differs from pull request most recent head bc2c7d3

Please upload reports for the commit bc2c7d3 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8306      +/-   ##
==========================================
+ Coverage   77.23%   77.37%   +0.13%     
==========================================
  Files         470      470              
  Lines       61572    61404     -168     
==========================================
- Hits        47558    47513      -45     
+ Misses      10426    10324     -102     
+ Partials     3588     3567      -21     
Flag Coverage Δ
unittests 77.37% <84.70%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Jun 18, 2024
@JmPotato JmPotato force-pushed the add_log_desen_mark branch 2 times, most recently from 9fb0641 to 08dd6ee Compare June 19, 2024 06:22
pkg/utils/configutil/configutil.go Outdated Show resolved Hide resolved
Copy link
Contributor

ti-chi-bot bot commented Jun 19, 2024

@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

pkg/utils/logutil/log.go Outdated Show resolved Hide resolved
@JmPotato JmPotato force-pushed the add_log_desen_mark branch 4 times, most recently from e358430 to 40b826f Compare June 27, 2024 15:00
@JmPotato JmPotato requested review from okJiang and rleungx June 27, 2024 15:06
@JmPotato JmPotato mentioned this pull request Jun 27, 2024
5 tasks
conf/config.toml Outdated Show resolved Hide resolved
pkg/utils/logutil/log.go Outdated Show resolved Hide resolved
{`false`, RedactInfoLogOFF},
{`true`, RedactInfoLogON},
{`"MARK"`, RedactInfoLogMark},
{`"OTHER"`, RedactInfoLogON},
Copy link
Member

Choose a reason for hiding this comment

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

Why OTHER should be ON?

Copy link
Member Author

Choose a reason for hiding this comment

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

I consider that if the user uses a string other than true/false and it is not MARK, at least the enabled state should be retained. Of course, this can also be discussed, and I remain open to this.

Copy link
Member

Choose a reason for hiding this comment

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

Just reach an agreement with PM~

Copy link
Member Author

Choose a reason for hiding this comment

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

I modified the behavior to be consistent with TiDB, only allowing it to be true/false/"MARKER". PTAL.

pkg/utils/logutil/log.go Outdated Show resolved Hide resolved
pkg/utils/logutil/log.go Outdated Show resolved Hide resolved
rightMark = '›'
)

func redactInfo(input string) string {
Copy link
Member

Choose a reason for hiding this comment

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

redactInfo just wraps the input with < >, it doesn't allow configuring specific strings to replace values in the logs. This is different from the logic in your code two weeks ago, is this what you expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, after discussion with PM, this is the only behavior when MARK is enabled.

Copy link
Member

@okJiang okJiang Jul 1, 2024

Choose a reason for hiding this comment

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

After checking the tidb_redact_log, it really is like that. I think it a bit strange, does it have a desensitizing effect?

Copy link
Member Author

Choose a reason for hiding this comment

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

The purpose of this feature is to allow the cloud or customers to customize how to handle sensitive information. As for the output here in PD, sensitive information will not actually be desensitized; it is up to the user to decide how to handle this sensitive information.

Copy link
Member

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 1, 2024
Copy link
Member

@HuSharp HuSharp left a comment

Choose a reason for hiding this comment

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

nit: Can you add to the pr description the log display for different log settings?

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 1, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-01 05:37:11.132267098 +0000 UTC m=+1216357.617755925: ☑️ agreed by rleungx.
  • 2024-07-01 07:36:32.296966322 +0000 UTC m=+1223518.782455157: ☑️ agreed by HuSharp.

@JmPotato
Copy link
Member Author

JmPotato commented Jul 1, 2024

nit: Can you add to the pr description the log display for different log settings?

Pasted. PTAL.

/approve

Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HuSharp, JmPotato, niubell, okJiang, rleungx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Jul 1, 2024
@ti-chi-bot ti-chi-bot bot merged commit b3bccce into tikv:master Jul 1, 2024
17 checks passed
@JmPotato JmPotato deleted the add_log_desen_mark branch July 1, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants