fix(server): cap Serilog file-sink retention and size (mxaccessgw#208)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m31s
ci / java (push) Successful in 2m46s
ci / portable (push) Failing after 5m16s

Set retainedFileCountLimit=30, fileSizeLimitBytes=50 MiB and rollOnFileSizeLimit=true on the
file sink in appsettings.json and appsettings.Development.json; document under a new Logging
section in docs/GatewayConfiguration.md; add a guard test over the shipped config.
This commit is contained in:
Joseph Doherty
2026-11-09 12:09:10 -05:00
parent 0d156b56cc
commit be0d585f8c
4 changed files with 66 additions and 2 deletions
+16
View File
@@ -742,6 +742,22 @@ protected DACL whose only entry grants its own account (the account the worker
is launched as); on the non-Windows test matrix it uses
`PipeOptions.CurrentUserOnly`. See `WorkerPipeSecurity` and [Worker Frame Protocol](./WorkerFrameProtocol.md).
## Logging (Serilog file sink)
Logging is configured under the top-level `Serilog` section (not `MxGateway`) in `appsettings.json`. The file
sink writes `logs/mxgateway-<date>.log` and is bounded so a long-running gateway cannot fill its disk:
| Key (`Serilog:WriteTo:1:Args:`) | Shipped value | Meaning |
|---|---|---|
| `rollingInterval` | `Day` | A new file per day. |
| `retainedFileCountLimit` | `30` | Keep at most 30 files; older ones are deleted when a new file is created. |
| `fileSizeLimitBytes` | `52428800` (50 MiB) | Per-file size cap. |
| `rollOnFileSizeLimit` | `true` | Start a new file at the cap instead of silently dropping events for the rest of the day (the Serilog default when a size limit is set without this flag). |
Worst-case on-disk log footprint is therefore about `retainedFileCountLimit x fileSizeLimitBytes` (1.5 GiB).
Raise or lower these in the deployed `appsettings.json` (or via `Serilog__WriteTo__1__Args__*` environment
variables) to fit the host's disk budget.
## Related Documentation
- [Gateway Process Detailed Design](./GatewayProcessDesign.md)