Logging

Quick overview of Buru SFTP Server logging capabilities.

Startup logging

Whenever Buru SFTP Server or Web Administration starts, either as a service or from a console, a startup log is created in the logs subdirectory of the configuration directory. This log is particularly useful when troubleshooting startup issues.

Startup log can be disabled using the --no-startup-log command line option.

SSH/SFTP server logging

Additional logging to a file can be enabled in the configuration file. There are two types or logs: server and access logs.

Server logs are written in semi-structured plaintext format and can be used for troubleshooting purposes. You can specify the log level, such as Information or Debug.

Access logs are written in JSON format and are useful for analyzing user activity.

You can configure the log retention policy for both types of logs using the maxFileCount option.

Overriding the configuration

If you need to debug something quickly, you can use the --log-level command line option to override the minimal log level.

Advanced logging

Experienced users (familiar with .NET development) can configure logging to fit their needs using Serilog configuration file. This file must be named logging.json and located in the configuration directory.

logging: { useCustomConfig: true } must be set in the config.yaml configuration file.

Any library dependencies not included in the release must be copied from e.g. nuget.org to the installation directory (where other Serilog.*.dll files are located), including their transitive dependencies. Extra care should be taken to ensure that the supplied dll files are compatible with the version of Serilog and other pre-existing libraries.

Replacing the already existing Serilog.*.dll files with different versions is sometimes possible but not recommended since it may lead to application instability and failures.

Access logs are distinguished by Access Serilog property.

Configuration example

The example shows how to configure Serilog to write to a file, to the console and send errors to an email address.

Since Serilog.Sinks.Email is not included in the release, it needs to be supplied manually, including all its dependencies:

logging.json
{
  "Serilog": {
    "Using": [
      "Serilog.Sinks.Console",
      "Serilog.Sinks.File",
      "Serilog.Sinks.Email"
    ],
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "Console"
      },
      {
        "Name": "File",
        "Args": {
          "path": "D:\\logs\\buru.log",
          "restrictedToMinimumLevel": "Warning"
        }
      },
      {
        "Name": "Email",
        "Args": {
          "restrictedToMinimumLevel": "Error",
          "fromEmail": "mail@rebex.net",
          "toEmail": "mail@rebex.net",
          "mailServer": "smtp"
        }
      }
    ]
  }
}
config.yaml
logging:
  useCustomConfig: true

Nuget versions

Changes since previous version are marked in bold.

Library Buru 2.5.1+ Buru 2.6.0+ Buru 2.7.2+ Buru 2.9.3+ Buru 2.15.0+
.NET netcoreapp3.1 net6.0 net6.0 net6.0 net6.0
Serilog 2.10 2.10 2.11 2.12 4.0
Serilog.Extensions.Hosting 4.1.2 4.2 5.0.1 7.0 8.0
Serilog.Extensions.Logging 3.1 3.1 3.1 7.0 8.0
Serilog.Formatting.Compact 1.1 1.1 1.1 1.1 3.0
Serilog.Settings.Configuration 3.3 3.3 3.3 7.0 8.0
Serilog.Sinks.ColoredConsole 3.0.1 3.0.1 3.0.1 3.0.1 3.0.1
Serilog.Sinks.Console 4.0 4.0.1 4.0.1 4.1 6.0
Serilog.Sinks.Debug 2.0 2.0 2.0 2.0 2.0
Serilog.Sinks.EventLog 3.1 3.1 3.1 3.1 3.1
Serilog.Sinks.File 5.0 5.0 5.0 5.0 5.0
Serilog.Sinks.RollingFile 3.3 3.3 3.3 3.3 3.3
Serilog.Sinks.TextWriter 2.1 2.1 2.1 2.1 2.1

Web administration logging

For Web administration, you can also enable additional logging to a file in the webconfig configuration file.

Like SSH/SFTP server logging, logs are written in plaintext format, and you can specify the log level and file retention policy.