feat(logging): add LOG_FILTER for access log noise reduction#295
Merged
feat(logging): add LOG_FILTER for access log noise reduction#295
Conversation
- Add LOG_FILTER environment variable to filter requests from access logs - Default filters Claude Code polling (GET / with claude-code user agent) - Support method, path (exact or prefix with *), and userAgent matching - Set LOG_FILTER='[]' to log all requests - Add Zod schema validation with startup warning for invalid JSON - Log active filter count at startup Closes #290
- Add LOG_FILTER and shouldSkipAccessLogRequest to all jest.doMock calls that override the config module - Fixes test failures caused by missing mock values after jest.resetModules
Test Coverage ReportOverall Coverage: 95.77%
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Add test for logInfo call when LOG_FILTER has rules - Add test verifying access logging middleware skips requests matching shouldSkipAccessLogRequest filter
- Changed em-dash (—) to "Claude Code filter" for consistency with the summary table at the top of the Logging section
- /health endpoint is registered BEFORE access logging middleware - Requests to /health never go through access logging - Removed examples suggesting to filter /health (unnecessary) - Added note explaining /health is not logged
- Added expect(console.warn).toHaveBeenCalled() to invalid schema test - Matches pattern used in invalid JSON test (lines 991-1004)
- Added LOG_FORMAT: "condensed" to main jest.mock and all jest.doMock calls for config module consistency
…prequests-filter-for-access' into feat/#290-featlogging-add-logskiprequests-filter-for-access
- Whitespace-only LOG_FILTER now falls back to default filter instead of disabling all filtering (empty array) - Add unit test for shouldSkipAccessLogRequest with Express Request
sw-release-bot bot
pushed a commit
that referenced
this pull request
Feb 5, 2026
## [6.58.0](v6.57.0...v6.58.0) (2026-02-05) ### Features * **logging:** add LOG_FILTER for access log noise reduction ([#295](#295)) ([d0c3d0d](d0c3d0d)), closes [#290](#290) ### Bug Fixes * **ci:** configure git credentials for semantic-release tag upload ([#298](#298)) ([6563291](6563291)), closes [#297](#297) * **ci:** remove duplicate Authorization header, add token scope ([#300](#300)) ([4032584](4032584)), closes [#299](#299)
|
🎉 This PR is included in version 6.58.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LOG_FILTERenvironment variable to filter requests from access logsGET /withclaude-codeuser agent)method,path(exact or prefix with*), anduserAgentmatchingLOG_FILTER='[]'to log all requestsChanges
src/config.ts: Zod schema, parsing,shouldSkipAccessLog()functionsrc/server.ts: Apply filter in access log middlewaredocs/guide/configuration.md: Documentation with examples.env.example: Configuration referencetests/unit/config.test.ts: 24 new tests for filter logicTest plan
yarn lintpassesyarn test tests/unit/config.test.ts— 106 tests passCloses #290