Repository navigation
feat(logging): write warnings to stderr in prod as they happen (#524 follow-up) - #559
Merged
Merged
Conversation
…follow-up) Since #558, prod writes only errors (with their buffered request context). Warnings from requests that don't fail were no longer written anywhere. On 3.8.0 that was about 28k a day, and they pointed at real problems: the avatar fallback (#556, which members have unreadable avatar files), header injection in the language switcher (#550), undecodable sessions (#532). - warnings: a filter handler that passes only the warning level, straight to php://stderr as JSON, no buffer. Errors stay with "main", so an error is never written twice. A warning in a request that later fails appears twice (alone and as context of the error), about 400 requests a day. - Deprecations, notices and debug stay off. Volume: about 28k lines a day, about 20k once ROX-502 (alias.cache.ini warning) is fixed.
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.
Target branch:
feature/docker-master(prod builds from it). Follow-up to #524 / #558. Config only; it survives the #519 upgrade.Why
Since #558 (rox 3.8.1), prod writes only errors, each with the records buffered before it in the same request. Warnings from requests that don't fail are no longer written anywhere. On 3.8.0 that was about 28k a day, and several pointed at real problems:
Avatar image ... is missing or not readable), which says which members have unreadable avatar filesHeader may not contain more than a single header(Language switcher: broken redirect without Referer (Header may not contain more than a single header) and open redirect #550)session_start(): Failed to decode session object(Sessions that cannot be decoded return 500 (Failed to start the session) #532)Undefined array keyinSuggestLocationModeland the Wikitext parserWhat
config/packages/prod/monolog.yaml: awarningsfilter handler that passes only thewarninglevel, straight tophp://stderras JSON, without a buffer.main, so an error is never written twice.Volume: about 28k lines a day, about 20k once ROX-502 (the
alias.cache.iniwarning, about 7.5k a day) is fixed. All of VictoriaLogs takes in about 876k rows a day.Tested
In the
rox:3.8.1image with this config mounted, using a test kernel that exposes the loggers:php.WARNING)DEPRECATION_LOGunset)var/logstayed empty, anddebug:config monologresolves.After merge (stage)
service:php level:warn* fields.channel:*shows warnings in VictoriaLogs._time:24h env:stage service:php fields.level_name:WARNING | stats count().