elsa-core/specs/004-diagnostics-structured-logs/quickstart.md
Sipke Schoorstra ab3e46bbe2
[codex] Add live server log streaming diagnostics (#7438)
* Add live server logs Spec Kit plan

* Implement live server logs diagnostics module

* Add server log sources and redaction hardening

* Add diagnostics unit tests

* Harden server log hub subscriptions

* Secure server log hub permissions

* Validate server log filter updates

* Add diagnostics logger and source tests

* Add diagnostics integration test project

* Add multi-source diagnostics provider coverage

* Broadcast server log source changes

* Document diagnostics server log streaming

* Add diagnostics sample host wiring

* Record diagnostics validation results

* Address server log PR feedback

* Rename diagnostics module to server logs

* Add server logs shell feature

* Make server logs shell options bindable

* Accept read wildcard for server logs

* Align server logs authorization with API patterns

* Update CShells structure and logging levels, add diagnostics module

* Rename PostgreSql shell feature classes for consistency

* Switch from Sqlite to PostgreSQL for workflow and identity persistence, add QuartzPostgreSql configuration

* Refactor server logs into diagnostics structured logs (#7440)

* Specify diagnostics structured logs refactor

* docs: clarify structured logs spec

* docs: plan diagnostics structured logs

* docs: add diagnostics structured logs tasks

* refactor: rename server logs to diagnostics structured logs

* Refactor PostgreSql persistence features to use centralized entity model handler registration.

* Refactor EFCore persistence features to centralize entity model handler registration for MySql, Sqlite, and Oracle providers.

* Integrate structured logs by renaming server logs, adjusting appsettings, and updating project references.

* Switch from PostgreSQL to Sqlite for workflow and identity persistence, update appsettings configuration.
2026-05-11 00:08:52 +02:00

67 lines
2.4 KiB
Markdown

# Quickstart: Diagnostics Structured Logs
## Configure the module
```csharp
services.AddElsa(elsa =>
{
elsa.UseStructuredLogs(options =>
{
options.RecentLogCapacity = 5_000;
options.SubscriberChannelCapacity = 1_000;
options.MaxRecentLogQuerySize = 1_000;
});
});
```
## Map the hub
```csharp
app.UseStructuredLogs();
```
This maps the SignalR hub at `/elsa/hubs/diagnostics/structured-logs`. FastEndpoints maps recent-log and source-list endpoints under the configured Elsa API prefix at `/diagnostics/structured-logs/recent` and `/diagnostics/structured-logs/sources`.
## Shell feature configuration
Shell-based hosts enable the feature with the diagnostics structured logs shell feature name:
```json
{
"ShellFeatures": {
"Elsa.Diagnostics.StructuredLogs.ShellFeatures.StructuredLogsFeature": {
"RecentLogCapacity": 5000,
"SubscriberChannelCapacity": 1000,
"MaxRecentLogQuerySize": 1000,
"IncludeStructuredLogsInternalLogs": false
}
}
}
```
## Authorization
Grant operational users the `read:diagnostics:structured-logs` permission.
## What this module captures
The module captures structured `ILogger` records, including rendered messages, message templates, named properties, active scopes, exceptions, source metadata, and trace/span IDs when available.
Direct stdout/stderr writes are out of scope for this module and belong to a future diagnostics console logs module. Trace waterfalls, metric charts, and span exploration belong to a future diagnostics OpenTelemetry module.
## Validation
Run targeted checks after implementation:
```bash
dotnet build src/modules/Elsa.Diagnostics.StructuredLogs/Elsa.Diagnostics.StructuredLogs.csproj
dotnet test test/unit/Elsa.Diagnostics.StructuredLogs.UnitTests/Elsa.Diagnostics.StructuredLogs.UnitTests.csproj
dotnet test test/integration/Elsa.Diagnostics.StructuredLogs.IntegrationTests/Elsa.Diagnostics.StructuredLogs.IntegrationTests.csproj
```
Validation on 2026-05-10:
- `dotnet build src/modules/Elsa.Diagnostics.StructuredLogs/Elsa.Diagnostics.StructuredLogs.csproj` passed.
- `dotnet test test/unit/Elsa.Diagnostics.StructuredLogs.UnitTests/Elsa.Diagnostics.StructuredLogs.UnitTests.csproj` passed with 28 tests.
- `dotnet test test/integration/Elsa.Diagnostics.StructuredLogs.IntegrationTests/Elsa.Diagnostics.StructuredLogs.IntegrationTests.csproj` passed with 6 tests.