feat: add log record filtering - #153
Conversation
|
|
||
| ### Filtering logs | ||
|
|
||
| Use `appLoggingFilter` to suppress selected log records before they reach the logger or destination. The filter runs synchronously and receives the log level, structured extra data and the final message, including context prefixes and postfixes. Return `true` to keep the record or `false` to suppress it: |
There was a problem hiding this comment.
Won't sensitive keys config be enough?
There was a problem hiding this comment.
In our logs we have records from core like "GRPC: Initiating request" and "GRPC: Request started". We don't need to keep in logs information about initializing request or about successful user authentication for every request. So we want to filter records via regexp.
There was a problem hiding this comment.
I'm not completely against this feature, but I feel that it's not the right tool for the job. If you don't need any log lines, it would be better to be able to configure that place (grpc in the UI gateway?) to not emit such messages. Otherwise, tomorrow they might change the message format slightly and your regular expressions will become obsolete.
Summary
appLoggingFilterpredicate over structured log recordsappLoggerbefore serialization and destination writesTesting
npm run lintnpm run typechecknpm test(15 suites, 120 tests)I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en.