Skip to content

Serilog.Sinks.Seq

reference
1 min readUpdated

Kind: Service

Source: Pams/API/Pams.API/Pams.API.csproj (line 1)

Part of: Pams

NuGet package dependency

Serilog.Sinks.Seq is a NuGet dependency for the Pams API that sends Serilog log events to a Seq server. It connects application logging configuration to Seq ingestion endpoints for centralized event storage and querying.

Diagram

mermaid
sequenceDiagram
    participant API as Pams API
    participant Serilog as Serilog
    participant Sink as Serilog.Sinks.Seq
    participant Seq as Seq Server

    API->>Serilog: Write log event
    Serilog->>Sink: Format event for Seq
    Sink->>Seq: POST event batch
    Seq-->>Sink: Accept response

Usage

ts
const seqUrl = "https://seq.example.com/api/events/raw";
const apiKey = process.env.SEQ_API_KEY;

const logEvent = {
  "@t": new Date().toISOString(),
  "@l": "Information",
  "@mt": "Pams API request completed",
  RequestPath: "/api/patients",
  StatusCode: 200
};

await fetch(seqUrl, {
  method: "POST",
  headers: {
    "Content-Type": "application/vnd.serilog.clef",
    "X-Seq-ApiKey": apiKey ?? ""
  },
  body: `${JSON.stringify(logEvent)}\n`
});

AI Coding Instructions

  • Configure Serilog.Sinks.Seq in the Pams API logging pipeline rather than posting log events manually from application code.
  • Keep the Seq server URL and API key in configuration or environment variables, not source code.
  • Include structured properties such as request paths, status codes, user identifiers, and correlation identifiers in log events.
  • Use Seq ingestion failures as logging diagnostics; do not allow logging transport failures to interrupt API request handling.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Injected or called by (1)

  • Pams.APIPams/API/Pams.API/Pams.API.csproj:1

Was this page helpful?

Download as PDF