Skip to content

feat: add log record filtering - #153

Open
melikhov-dev wants to merge 1 commit into
mainfrom
feat/logging-filter
Open

feat: add log record filtering#153
melikhov-dev wants to merge 1 commit into
mainfrom
feat/logging-filter

Conversation

@melikhov-dev

Copy link
Copy Markdown
Contributor

Summary

  • add a synchronous appLoggingFilter predicate over structured log records
  • apply filtering to both the default logger and appLogger before serialization and destination writes
  • document regex-based filtering while preserving tracing events and span status

Testing

  • npm run lint
  • npm run typecheck
  • npm test (15 suites, 120 tests)

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en.

@melikhov-dev
melikhov-dev requested a review from resure as a code owner September 4, 2026 10:06
Comment thread docs/contexts.md

### 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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't sensitive keys config be enough?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@resure resure Sep 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@melikhov-dev
melikhov-dev requested a review from resure September 4, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants