serilog-structured

Configure Serilog structured logging with enrichers and a Seq sink.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill serilog-structured
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serilog-structured
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/observability/serilog-structured
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill serilog-structured

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes and structures application logs so startup failures, contextual diagnostics, and operational events are searchable and queryable instead of hidden in free-form text logs.

Core Features & Use Cases

  • Two-stage bootstrap to capture startup errors before full configuration is available.
  • Structured message templates and object destructuring to preserve queryable properties.
  • Enrichers for Application, MachineName, and CorrelationId to provide consistent context across services.
  • Seq sink for centralized aggregation, querying, and retention of structured events.
  • Per-namespace level overrides and request logging enrichment to reduce noise and capture user/context metadata.
  • Use Cases: diagnosing production incidents, centralizing logs across microservices, and instrumenting request flows for observability.

Quick Start

Set up Serilog with a two-stage bootstrap in Program.cs, add Application, MachineName and CorrelationId enrichers, enable request logging enrichment, and configure the Seq sink via appsettings.json or environment variables.

Frequently Asked Questions about serilog-structured

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Serilog structured logging in ASP.NET Core to capture startup errors?

To configure Serilog structured logging and capture startup errors, use a two-stage bootstrap in Program.cs. This initializes a basic logger before full application configuration is available, ensuring early failures are logged to the Seq sink instead of being lost during ASP.NET Core startup.

What's the best way to add enrichers for Application, MachineName, and CorrelationId in Serilog?

Adding enrichers for Application, MachineName, and CorrelationId in Serilog involves attaching these properties to the logging pipeline during setup. This enriches structured logs with consistent contextual metadata across microservices, making operational events searchable and correlated in Seq.

How do I set up per-namespace log level overrides in Serilog for development and production?

Per-namespace log level overrides in Serilog are configured to manage log verbosity across environments. By applying environment-specific level overrides during development and production diagnostics, you reduce log noise while capturing necessary structured application events from targeted namespaces.

How do I configure a Seq sink in Serilog using appsettings or environment variables?

Configuring a Seq sink in Serilog using appsettings or environment variables involves defining the Seq connection parameters within your configuration system. This allows the logging pipeline to ship structured events to Seq for centralized aggregation, querying, and retention without hardcoding values.

Why use structured logging with Serilog and Seq instead of free-form text logs?

Structured logging with Serilog and Seq replaces free-form text logs by preserving queryable properties through message templates and object destructuring. This makes contextual diagnostics and operational events fully searchable, enabling rapid incident diagnosis and observability across distributed services.

Does Serilog request logging enrichment capture user and context metadata in ASP.NET Core?

Serilog request logging enrichment in ASP.NET Core captures user and context metadata by injecting properties like CorrelationId into the HTTP request pipeline. This instruments request flows for observability, ensuring every log event carries the necessary context for tracing user activity.