Skip to content

If Timestamp column is set to UTC, Timestamp property in LogEvent column should be UTC too #659

@marcominerva

Description

@marcominerva

I have the following configuration with Serilog.Sinks.MSSqlServer v9.0.02:

"Serilog": { "Using": [ "Serilog.Sinks.MSSqlServer" ], "MinimumLevel": { "Default": "Information" }, "WriteTo": [ { "Name": "MSSqlServer", "Args": { "connectionString": "LogsConnection", "sinkOptionsSection": { "tableName": "Logs", "autoCreateSqlTable": true }, "restrictedToMinimumLevel": "Information", "columnOptionsSection": { "addStandardColumns": [ "LogEvent" ], "removeStandardColumns": [ "MessageTemplate", "Properties" ], "timeStamp": { "columnName": "Timestamp", "convertToUtc": true, }, "logEvent": { "excludeAdditionalProperties": false, "excludeStandardColumns": false } } } } ], "Enrich": [ "FromLogContext" ] }

In particular, I have set the convertToUtc property of timeStamp column to true. With this configuration, I expect that also the Timestamp property in the JSON LogEvent column will be saved as UTC. However, I see values like this:

{ "Timestamp":"2025-12-12T08:30:25.4094643", "Level":"Information", "Message":"Request finished \"HTTP/2\" \"GET\" \"https\"://\"localhost:7164\"\"\"\"/api/ping\"\"\" - 200 0 null 39.3178ms", // ... }

Where Timestamp property is missing the Z modifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions