* Avoid null endpoint DTO metadata in tests * Enforce console logs hub read permission * Remove unused console logs hub import * Support mapped endpoint metadata in auth tests * Reduce console log capture throughput impact * Address Copilot console logs review * Refactor task scheduling to support tenant-level background work and enhance logging functionality. * Introduce ConsoleStreamHook for stdout/stderr tee and enhance logging validation. Adjust test cases and startup warnings for distributed lock provider usage. * Refactor console logging pipeline with capture optimization and new ConsoleLogsHost; update tests accordingly. * Add Ansi SGR parser for console logs and associated unit tests * Remove ANSI color renderings and parsers; integrate ConsoleLogScopeAccessor for improved logging context with workflow instance ID support. * Address console logs code quality feedback * Address PR review feedback * Preserve console logs extension points * Stabilize console logs host lifecycle * Address final automated review comments * Tighten console log capture shutdown * Address console log review feedback * Address follow-up review feedback * Cover final review feedback * Avoid recursive console provider initialization * Guard console host lease shutdown * Preserve console log scope and provider lifetime * Correlate console log scope fallback * Tighten console scope correlation * Expose host services during provider construction * Redact ANSI-normalized console lines * Remove `ConsoleCaptureTee` and related services and tests * Use pipeline contributors for console log context * Update CShells package versions to 0.0.24-preview.132 * Filter live console logs by workflow instance * Enhance console logging with activity execution metadata and extend test coverage. * Address console logs stream consumption comment * Add diagnostics OpenTelemetry backend * Introduce dedicated workflow JSON type registry and hardening This change addresses GitHub issue #7541 by establishing a separate type registry (`IWorkflowJsonTypeRegistry`) for workflow JSON serialization. This decouples workflow type resolution from expression type aliases, enforcing a strict trust boundary. Key aspects: - New workflow JSON emits preferred aliases for registered types. - Existing persisted workflows can be loaded via registered legacy names. - Unknown, abstract, interface, open generic, or inappropriate collection types are rejected during deserialization, enhancing security. - Public APIs (e.g., incident strategies) now expose consistent workflow JSON type identifiers. This ensures secure, predictable, and backward-compatible handling of types within workflow definitions and payloads. * Remove unused project references and streamline console log endpoint * Move serialization type aliases to Elsa.Common * Update serialization integration fixtures for aliases * Stabilize missing rate limiter policy test |
||
|---|---|---|
| .. | ||
| Contracts | ||
| Endpoints/ConsoleLogs | ||
| Extensions | ||
| Features | ||
| Permissions | ||
| RealTime | ||
| Services | ||
| ShellFeatures | ||
| AssemblyInfo.cs | ||
| Elsa.Diagnostics.ConsoleLogs.csproj | ||
| FodyWeavers.xml | ||
| README.md | ||
| Usings.cs | ||
Elsa Diagnostics Console Logs
Elsa.Diagnostics.ConsoleLogs is an opt-in Core module for operational diagnostics. It hosts ConsoleLogStreaming.Core, adds Elsa workflow metadata, and exposes recent plus live console output to authorized callers.
What It Captures
- Raw
stdoutandstderrlines from the current backend process. - Source metadata for the current process, machine, and container environment when available.
- Recent bounded history and live SignalR events.
- Dropped-line summaries when recent buffers or subscriber queues overflow.
The module is separate from Elsa.Diagnostics.StructuredLogs. It does not parse ILogger records, provide durable audit storage, call orchestrator log APIs, or implement trace/metric exploration.
Capture, redaction, buffering, source tracking, provider contracts, and live subscriptions come from ConsoleLogStreaming.Core. Elsa keeps only the module wiring, workflow metadata accessor, authorization, REST endpoints, SignalR hub, and DTO mapping.
Configure
services.AddElsa(elsa =>
{
elsa.UseConsoleLogs(options =>
{
options.RecentCapacity = 5_000;
options.SubscriberCapacity = 1_000;
options.MaxRecentQuerySize = 1_000;
options.MaxLineLength = 16_384;
options.PreserveAnsi = true; // pass colors through to consumers
});
});
Map the live hub:
app.UseConsoleLogs();
Capturing Colors
The capture passes raw stdout/stderr bytes through to consumers. ANSI escape sequences (colors, cursor
moves) are preserved by default; consumers (e.g. the Studio's Raw ANSI toggle) decide whether to render
them or strip them on display.
Whether colors actually arrive at the capture depends on whether the .NET console logger emits them.
Microsoft.Extensions.Logging.Console's SimpleConsoleFormatter defaults to LoggerColorBehavior.Default,
which suppresses colors whenever Console.IsOutputRedirected is true — that includes most Docker/Kubernetes
deployments, IDE-hosted runs (JetBrains Rider, VS Code), and any piped stdout. To force colors regardless,
add the following to appsettings.json (no module dependency required):
"Logging": {
"Console": {
"FormatterOptions": {
"ColorBehavior": "Enabled"
}
}
}
With ColorBehavior = Enabled, the logger writes ANSI sequences such as \x1b[32m and \x1b[0m into the
tee, the capture publishes them verbatim, and the Studio renders them.
Contracts
- Recent lines:
POST /diagnostics/console-logs/recent - Sources:
GET /diagnostics/console-logs/sources - Live hub:
/elsa/hubs/diagnostics/console-logs - Permission:
read:diagnostics:console-logs
Recent, source, and hub access all require the same permission.
Custom storage providers should implement ConsoleLogStreaming.Core.IConsoleLogProvider and use the core models. Elsa-specific values such as workflow instance IDs are represented as metadata internally and projected onto shared ConsoleLogStreaming.Core.Models DTOs at the REST and SignalR boundaries.
Safety Boundaries
- Redaction runs before recent buffering, live streaming, endpoint responses, and provider storage.
- ANSI escape sequences are preserved by default; set
PreserveAnsi = falseto strip them server-side. - Partial writes are buffered until newline, max line length, or idle flush.
- Oversized lines are truncated to one event and marked as truncated.
- Core providers receive only redacted line text and redacted source metadata.