Serilog section configuration
The Serilog section of the appsettings.json file defines which events are recorded in the Portal and Service logs and where they are written: to the database, to a file, to the console, or to the Windows Event Log.
Make changes only in the appsettings.Production.json file. The appsettings.json file is overwritten during updates — see appsettings.json file configuration.
Section structure
| Node | Purpose |
|---|---|
Using | List of modules that provide log destinations (sinks) and enrichers. |
MinimumLevel | Minimum level of events recorded by the application. |
WriteTo | Log destinations and their parameters. |
Enrich | Additional information attached to every entry. |
Default configuration from the appsettings.json template:
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.MSSqlServer",
"Serilog.Sinks.File",
"Serilog.Enrichers.ClientInfo"
],
"MinimumLevel": {
"Default": "Warning"
},
"WriteTo": {
"ConsoleSink": "Console",
"MSSqlServerSink": {
"Name": "MSSqlServer",
"Args": {
"connectionString": "LogsDb",
"tableName": "Logs",
"schemaName": "infrastructure",
"autoCreateSqlTable": true,
"restrictedToMinimumLevel": "Warning",
"columnOptionsSection": {
"addStandardColumns": [ "LogEvent", "TraceId", "SpanId" ],
"removeStandardColumns": [ "Properties" ],
"id": { "nonClusteredIndex": true },
"level": { "storeAsEnum": false },
"timeStamp": { "convertToUtc": true },
"logEvent": {
"excludeAdditionalProperties": true,
"excludeStandardColumns": true
}
}
}
},
"FileSink": {
"Name": "File",
"Args": {
"path": "Logs/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Fatal"
}
}
},
"Enrich": [ "FromLogContext", "WithClientIp" ]
}
Logging levels
Levels are used in the MinimumLevel and restrictedToMinimumLevel parameters. Events of the selected level and all higher levels are recorded.
| Level | Meaning |
|---|---|
Verbose | The most detailed diagnostic information. Produces a very large number of entries. |
Debug | Information useful for troubleshooting. |
Information | Events describing normal application operation, e.g., startup. |
Warning | Abnormal situations that do not interrupt application operation. Default value. |
Error | Errors that prevented an operation from being completed. |
Fatal | Critical errors after which the application cannot continue running. |
The Verbose, Debug, and Information levels significantly increase the number of entries, the server load, and the size of the log database. Use them temporarily, only while troubleshooting a problem.
Using
List of modules used by the configuration. Every sink or enricher used in the WriteTo and Enrich nodes must have a corresponding module in this list.
| Module | Provides |
|---|---|
Serilog.Sinks.Console | The Console sink. |
Serilog.Sinks.MSSqlServer | The MSSqlServer sink. |
Serilog.Sinks.File | The File sink. |
Serilog.Sinks.EventLog | The EventLog sink — not included in the template; it must be added in appsettings.Production.json. |
Serilog.Enrichers.ClientInfo | The WithClientIp enricher. |
The Using list from appsettings.Production.json does not replace the list from the template; instead, it overrides it item by item. When specifying the list in appsettings.Production.json, repeat all modules from the template in the same order and append new modules at the end.
The Serilog.Sinks.OpenTelemetry module is also shipped with the application; the application uses it to export logs through OpenTelemetry. Modules of other sinks, e.g. Seq or Application Insights, are not shipped – you can send logs to these tools through an OpenTelemetry exporter or the Azure Application Insights section. A module that is not present in the installation directory cannot be used.
MinimumLevel
| Parameter | Type | Default value | Description |
|---|---|---|---|
Default | level | Warning | Global minimum event level. Events of a lower level are skipped by all sinks, regardless of their restrictedToMinimumLevel setting – unless a different level is set for the given source in Override. |
Override.<source> | level | — (not included in the template) | Separate level for events from the selected source – higher or lower than Default, e.g., "Microsoft.AspNetCore": "Error" or "WebCon.WorkFlow.Module.Configuration": "Information". The source name is matched by prefix. WEBCON sources are listed on the Logging areas (loggers) page. |
Example — detailed logs for a selected WEBCON area while keeping the Warning level for all other events:
"Serilog": {
"MinimumLevel": {
"Default": "Warning",
"Override": {
"WebCon.WorkFlow.Module.Configuration": "Information"
}
}
}
Example — temporarily enabling the Information level while limiting entries from platform components:
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
}
}
To also write Information events to the log database, additionally lower the restrictedToMinimumLevel value of the MSSqlServer sink — see MSSqlServer.
WriteTo
The WriteTo node contains the log destinations (sinks). Each sink is an entry with an arbitrary, unique name (e.g., MSSqlServerSink, FileSink) that contains:
Name— the sink type (Console,MSSqlServer,File,EventLog),Args— the sink parameters.
Thanks to named entries, in appsettings.Production.json you can change a single parameter of an existing sink (by referring to its name, e.g., FileSink) or add a new sink under a new name (e.g., EventLogSink).
Parameter common to all sinks:
| Parameter | Type | Description |
|---|---|---|
restrictedToMinimumLevel | level | Minimum level of events recorded by the given sink. It works as an additional filter — it cannot lower the level defined in MinimumLevel.Default. |
A sink defined in the template cannot be fully disabled through appsettings.Production.json. To effectively stop writing to it, set its restrictedToMinimumLevel to Fatal – the application very rarely records events at this level. Example for the logs database:
"Serilog": {
"WriteTo": {
"MSSqlServerSink": {
"Args": {
"restrictedToMinimumLevel": "Fatal"
}
}
}
}
Console
Writes logs to the standard output of the application. In the template, it is defined in shorthand form as "ConsoleSink": "Console". Entries are visible only when the application is running in a console window.
MSSqlServer
Writes logs to a SQL Server database. This is the primary log destination for the Portal and the Service — by default, events of level Warning and higher are written to the Infrastructure.Logs table in the configuration database. Each entry has a CorrelationID identifier (in versions earlier than 2026 R1: ErrorGuid).
The log table is optional — logging can be configured without it, using other sinks. In large environments, it is recommended to create a separate database for logs (specified in ConnectionStrings.LogsDb) or to use specialized log collection tools.
| Parameter | Type | Default value | Description |
|---|---|---|---|
connectionString | text | LogsDb | Name of the connection string from the ConnectionStrings section (or a full connection string). |
tableName | text | Logs | Name of the table in which logs are stored. |
schemaName | text | infrastructure | Schema that contains the log table. |
autoCreateSqlTable | true / false | true | Automatically creates the log table at startup if it does not exist. Requires the account from the connection string to have permissions to create tables. |
restrictedToMinimumLevel | level | Warning | Minimum level of events stored in the database. |
columnOptionsSection | object | see below | Set of columns of the log table. |
columnOptionsSection settings in the template:
| Parameter | Value | Description |
|---|---|---|
addStandardColumns | LogEvent, TraceId, SpanId | Additional columns: the full event in JSON format and the trace and span identifiers (they allow you to correlate a log entry with an OpenTelemetry trace). |
removeStandardColumns | Properties | Columns that are omitted. |
id.nonClusteredIndex | true | Indexing method of the identifier column. |
level.storeAsEnum | false | The level is stored as text (e.g., Warning) rather than as a number. |
timeStamp.convertToUtc | true | The event time is stored in UTC. |
logEvent.excludeAdditionalProperties, logEvent.excludeStandardColumns | true | Limits the content of the LogEvent column to data that is not present in the other columns. |
Do not change the tableName, schemaName, or columnOptionsSection parameters unless there is a clear need to do so. Changing the structure of the log table may cause tools that read logs to stop displaying them.
The log table is created by the sink on the first write when autoCreateSqlTable is set to true – it is not created by the installer or the database update. Set the value to false only when the table already exists.
Entries older than 30 days are deleted automatically by the Service during database maintenance hours. The retention period cannot be changed. Automatic cleanup and searching for errors by identifier in Designer Studio cover only the log table in the configuration database – if LogsDb points to a different database, you need to take care of removing old entries yourself.
File
Writes logs to text files.
| Parameter | Type | Default value | Description |
|---|---|---|---|
path | text | Logs/log-.txt | File path. A relative path is resolved against the working directory of the application. The date is appended to the file name, e.g., log-20261005.txt. |
rollingInterval | value from list | Day | How often a new file is created — see the table below. |
outputTemplate | text | {Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception} | Format of a single entry: date and time, level abbreviation, message text, exception details. |
restrictedToMinimumLevel | level | Fatal | Minimum level of events written to the file. By default, only critical errors are written to the file. |
retainedFileCountLimit | number | 31 (not included in the template) | Number of retained files. Older files are deleted. |
fileSizeLimitBytes | number (bytes) | 1 GB (not included in the template) | Maximum size of a single file. |
rollOnFileSizeLimit | true / false | false (not included in the template) | When the size limit is reached, a new file is created instead of suspending writing. |
rollingInterval value | New file created |
|---|---|
Infinite | Never — all entries in a single file. |
Year | Every year. |
Month | Every month. |
Day | Every day. Default value. |
Hour | Every hour. |
Minute | Every minute. |
Example — writing events of level Error and higher to a file in an absolute directory, retaining 14 files:
"Serilog": {
"WriteTo": {
"FileSink": {
"Args": {
"path": "D:\\Logs\\WEBCON\\Portal\\log-.txt",
"restrictedToMinimumLevel": "Error",
"retainedFileCountLimit": 14
}
}
}
}
The account under which the application runs (the Portal application pool identity or the Service account) must have write permissions to the log directory.
There have been cases in which log files were not created when the default relative path was used. If writing to a file is important to you, specify an absolute path in path, as in the example above.
A relative path is resolved against the working directory of the process. For the Portal, this is the Portal installation directory, so files are created in its Logs subdirectory. The working directory of the Service, which runs as a Windows service, may be C:\Windows\System32 – so for the Service, specify an absolute path.
EventLog
Writes logs to the Windows Event Log. This sink is not included in the template, and in new installations logs are not written to the Event Log, only to the database.
During an update from a version earlier than 2026 R1, the installer adds the EventLog sink to the appsettings.Production.json file so that — as in previous versions — events of level Warning and higher are written to the Event Log. If the log fills up with warnings, set "restrictedToMinimumLevel": "Error" in the sink or remove the sink from appsettings.Production.json (events will still be written to the database).
To enable writing to the Event Log yourself, add the Serilog.Sinks.EventLog module to the Using list and add a new entry in WriteTo:
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.MSSqlServer",
"Serilog.Sinks.File",
"Serilog.Enrichers.ClientInfo",
"Serilog.Sinks.EventLog"
],
"WriteTo": {
"EventLogSink": {
"Name": "EventLog",
"Args": {
"logName": "WebCon WorkFlow",
"source": "WorkFlow",
"restrictedToMinimumLevel": "Error"
}
}
}
}
| Parameter | Type | Description |
|---|---|---|
logName | text | Log name. Entries are visible in Event Viewer under the Applications and Services Logs → <logName> node. |
source | text | Event source displayed in the Source column. |
restrictedToMinimumLevel | level | Minimum level of events written to the log. |
Creating a new log or event source requires administrator privileges. The application pool identity and the service account usually do not have them — if the source has not been registered beforehand, entries will not be written. The source can be registered once in PowerShell run as administrator:
New-EventLog -LogName "WebCon WorkFlow" -Source "WorkFlow"
Enrich
List of enrichers, that is, information automatically attached to every entry.
| Value | Description |
|---|---|
FromLogContext | Attaches contextual information set by the application while processing a request or task – including the CorrelationId correlation identifier assigned to every request. |
WithClientIp | Attaches the client IP address. When the Portal runs behind a proxy server, obtaining the correct address requires configuring the Security section. |
Regardless of this list, the application attaches a correlation identifier to entries (CorrelationId, also passed in the Correlation-ID HTTP header). It lets you find all entries related to a single request, also across different log destinations. HTTP request log entries additionally contain the signed-in user's login (User) and the request path including its parameters.