Configuration
The bundle is configured under a single monitor tree, conventionally in config/packages/monitor.yaml. Every value maps directly onto the monitor-php core types the bundle wires for you.
Full reference
Options
| Key | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Master switch. The services are always defined, and false acts at runtime: nothing is captured and nothing is sent. Defining them either way is what lets config/packages/dev/monitor.yaml set enabled: false without a monolog.yaml referencing monitor.log_handler failing to compile. |
url | string | null | Base URL of your Quiet Guard server. Endpoint paths are appended to it; a trailing slash is trimmed. Empty or absent means the hosted service at https://quietguard.dev: an application on it only has to supply the key. |
key | string | null | The per-project API token, sent as Authorization: Bearer <key>. |
timeout | int | 3 | Per-request transport timeout, in seconds. |
release | string | null | Optional release identifier (e.g. a commit SHA) attached to exception and log context. |
trace_limit | int | 0 | 0 (the default) ships the full stack trace with every exception; a positive value trims the payload to that many frames. The throw site, at the head of the stack since version 0.3, counts as one frame. |
code_snippets | bool | true | Sends, with each application frame, the five source lines on each side of its own, read from the file that ran. Never for a dependency; a line that names a scrub key and gives it a value is masked whole. false sends file and line only. |
environments | list of string | [] | Report only from these environments. Empty means report from all environments. Matched against kernel.environment. |
scrub | list of string | see below | Context keys whose values are masked before sending (recursive, case-insensitive; from version 0.3.1, a hyphen counts as an underscore). |
redact | list of string | email, iban, nir, card, phone | Value shapes masked wherever they sit, message text and URL segments included. An empty list turns it off. |
redact_custom | map of string | {} | Your own shapes, as label: PCRE pattern. A label of customer_ref masks as [redacted:customer_ref]. |
logs.enabled | bool | false | Turn log forwarding on. The handler service is always registered while the bundle is enabled; when false it drops every record. You still have to attach it to Monolog, see Usage. |
logs.level | string | warning | Minimum level the handler captures (a Monolog level name). |
logs.max_batch | int | 200 | Flush the log buffer to the server once it reaches this many records. |
Default scrub keys
When you do not set scrub, the bundle uses:
Setting scrub replaces this list, so include the defaults you still want to keep. From version 0.3.1, the scrubber also reaches the URL reported with each exception, a JSON value written as a string, and the values a log message carries when it starts with a URL or is JSON: see Usage.
Masking by the shape of the value
scrub looks at the key name. It never sees an address written into the free text of an exception message, into a URL segment, or into a field somebody called reference. redact looks at the value, on your own server, before anything is sent, and it is on by default with all five shapes.
That default was already applied before it was declared here, which is the reason it is worth stating plainly: the bundle masked values it never documented, and any attempt to configure it failed at container compilation with Unrecognized option. Both keys are part of the tree now.
Shapes carrying a check digit are verified rather than merely matched, so a sixteen digit order reference is not taken for a card number, and each mask names what it hid ([redacted:email]) so the message stays readable.
Environment variables
Nothing forces you to use environment variables, but it is the recommended pattern so secrets stay out of the repository. A typical wiring:
The %env(default::MONITOR_RELEASE)% form falls back to an empty value when the variable is unset, so release simply stays empty.
Restricting environments
By default (environments: []) the bundle reports from every environment, including dev. To report only from production:
Both the exception subscriber and the Monolog log handler check this list against kernel.environment before sending anything, so in any other environment nothing leaves your application, neither exceptions nor logs.
How the config maps to services
| Config | Service built |
|---|---|
url, key, timeout, release, environments, trace_limit, code_snippets, redact, redact_custom | monitor.config (Config) |
scrub | monitor.scrubber (Scrubber) |
trace_limit, release, code_snippets | monitor.payload_builder (ExceptionPayloadBuilder) |
enabled | monitor.exception_subscriber, which receives the switch and applies it at runtime |
| — | monitor.http_client (CurlHttpClient), monitor.reporter (Reporter), which takes the application's logger when one exists |
logs.* | monitor.log_handler (MonitorHandler), always registered while the bundle is enabled; with logs.enabled: false it drops every record, so a monolog.yaml referencing it keeps compiling |
See Usage for how these services behave at runtime.
You are reading the Symfony Bundle v1.0 documentation.