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

Feature: support Global prefix_filter for All Logs #17286

Open
youngsofun opened this issue Jan 14, 2025 · 2 comments
Open

Feature: support Global prefix_filter for All Logs #17286

youngsofun opened this issue Jan 14, 2025 · 2 comments
Labels
C-feature Category: feature

Comments

@youngsofun
Copy link
Member

Current Behavior

Currently, the prefix_filter configuration is only supported for file logs. However, when a user enables this configuration, they likely expect it to apply to all log outputs, not just file logs.

Proposed Enhancement

Introduce a global prefix_filter configuration that applies to all logs. The existing prefix_filter for file logs can be retained for finer control, and it will override the global prefix_filter if specified. This approach ensures backward compatibility while making the configuration more intuitive.

Compatibility

  • The default value for the global prefix_filter will remain "databend_,openraft", maintaining existing behavior.
  • Setting the prefix_filter to an empty string will allow all log targets to be included.

Benefits

  • Simplifies log configuration for users by reducing the need to duplicate filters across different log types.
  • Retains fine-grained control for file-specific log filters when needed.
  • Provides a more consistent behavior for logging across the system.

Example

[log]
prefix_filter = "databend_"  # new config

[log.file]
level = "DEBUG"
format = "text"
dir = "./.databend/logs_1"
prefix_filter = "databend_,openraft" 
@youngsofun youngsofun added the C-feature Category: feature label Jan 14, 2025
@youngsofun
Copy link
Member Author

cc @wubx

@Xuanwo
Copy link
Member

Xuanwo commented Jan 16, 2025

Hi, this got me thinking about whether RUST_LOG itself supports filtering: https://docs.rs/env_logger/latest/env_logger/#enabling-logging

Perhaps we could simply extend the support for levels and pass it down to the underlying logging tools?

For example:

[log.file]
level = "DEBUG,databend_query=info"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature
Projects
None yet
Development

No branches or pull requests

2 participants