serilog-mssql / serilog-sinks-mssqlserver

A Serilog sink that writes events to Microsoft SQL Server and Azure SQL
Apache License 2.0
283 stars 148 forks source link

TimeStamp column nullable or not #541

Closed cremor closed 1 month ago

cremor commented 5 months ago

Please clearly describe what the SQL Sink is doing incorrectly:

If I use the "autoCreateSqlDatabase": true setting, the [TimeStamp] column is created as NULL, although the readme says it's NOT NULL here.

Please clearly describe the expected behavior:

The auto created table should match the readme.

List the names and versions of all Serilog packages used in the project:

Target framework and operating system:

.NET 8 OS: Windows 10

Provide a simple reproduction of your Serilog configuration code:

builder.Host.UseSerilog((context, services, loggerConfiguration) => loggerConfiguration.ReadFrom.Configuration(context.Configuration));

Provide a simple reproduction of your Serilog configuration file, if any:

"Serilog": {
  "Using": [ "Common" ],
  "MinimumLevel": {
    "Default": "Information",
    "Override": {
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "WriteTo": {
    "DbSink": {
      "Name": "MSSqlServer",
      "Args": {
        "connectionString": "DefaultConnection",
        "sinkOptionsSection": {
          "tableName": "Logs",
          "autoCreateSqlTable": true
        }
      }
    }
  }
}

Provide a simple reproduction of your application code:

Just start the app to let the log table creation happen.