How to configure logging

Buru SFTP Server can record user activity and server events to help you troubleshoot issues and analyze server usage. There are three types of configurable logs:

  • Server logs: Written in semi-structured plaintext format, used for troubleshooting.
  • Access logs: Written in a CSV-like format, used for analyzing user activity. The format is not finalized and will change in the next major version release.
  • Web Administration logs: Separate logs for the Web Administration interface, configured independently.

In addition, startup logs are created automatically whenever the server or Web Administration starts.

SSH/SFTP server logging

Server and access logs are configured in the config.yaml file.

To configure server logging using the Web Administration, follow these steps:

  1. In the Web Admin interface, click Logging.
  2. Define the Directory and Keep at most for both Server and Access logs.
  3. Select the Minimum log level from the dropdown menu. (default is Warning)
  4. Click Save and restart.

To configure server logging using the config.yaml file, follow these steps:

  1. Open the config.yaml file.
  2. In the logging section, configure the server and access logs:
    logging:
      access:
        location: 'C:\BuruSftp\logs\access'
        maxFileCount: 0 # Keep files forever
      server:
        location: 'C:\BuruSftp\logs\server'
        minLevel: warning
        maxFileCount: 31 # Keep 1 month of logs
  3. Set log levels and retention with the following parameters:
    • minLevel: Specifies the minimum log level to record. Options: verbose, debug, information, warning, error and fatal. For more details, see the config.yaml logging guide.
    • maxFileCount: Defines the maximum number of log files to keep. The oldest files are deleted once this limit is reached. Set to 0 to disable deletion.

Restart the service

Restart the Buru SFTP service for the changes to take effect:

Press ⊞ Win + R, type services.msc, find Rebex Buru SFTP Server, right-click and select Restart.
burusftp svc restart
net stop RebexBuruSftp && net start RebexBuruSftp
Restart-Service RebexBuruSftp

Permissions

The SFTP server service user must have write access to the specified log locations.

To quickly override the minimum log level without editing the configuration file, use the --log-level command-line option when starting the server.

Startup logging

Startup logs are created automatically in the logs subdirectory of the configuration directory whenever the server or Web Administration starts. They are used for troubleshooting startup-specific issues and can be disabled with the --no-startup-log command-line option. To apply this option to an installed service, use Windows' sc.exe:

rem SSH/SFTP server
sc.exe config RebexBuruSftp binPath= "\"C:\Program Files\Rebex Buru SFTP Server\burusftp.exe\" run --run-as-service --no-startup-log"

rem Web Administration
sc.exe config RebexBuruSftpWA binPath= "\"C:\Program Files\Rebex Buru SFTP Server\burusftpwa.exe\" run --run-as-service --no-startup-log"
# sc.exe and PowerShell are finnicky about quoting — use a variable for the binPath value

# SSH/SFTP server
$binPath = "`"C:\Program Files\Rebex Buru SFTP Server\burusftp.exe`" run --run-as-service --no-startup-log"
sc.exe config RebexBuruSftp binPath= $binPath

# Web Administration
$binPath = "`"C:\Program Files\Rebex Buru SFTP Server\burusftpwa.exe`" run --run-as-service --no-startup-log"
sc.exe config RebexBuruSftpWA binPath= $binPath
# SSH/SFTP server
sc.exe config RebexBuruSftp binPath= '"C:\Program Files\Rebex Buru SFTP Server\burusftp.exe" run --run-as-service --no-startup-log'

# Web Administration
sc.exe config RebexBuruSftpWA binPath= '"C:\Program Files\Rebex Buru SFTP Server\burusftpwa.exe" run --run-as-service --no-startup-log'

Web Administration logging

Web Administration logging is configured separately in the webconfig.yaml file. Logging is disabled if location is not set.

  1. Open the webconfig.yaml file and locate the logging section. Specify the directory and minimum log level for the web interface:

    logging:
      location: 'C:\BuruSftp\logs\webadmin'
      minLevel: warning
      aspNetMinLevel: warning # Minimum level for ASP.NET framework events (HTTP requests, middleware, etc.)
      maxFileCount: 31

    Permissions

    The Web Administration service user must have write access to the specified log location.

  2. Restart the Web Administration service to apply changes. You can do this via the Services section in Windows Control Panel, or by running the following command as an administrator:

    burusftpwa svc restart

Advanced logging using Serilog

Experienced administrators familiar with .NET can configure logging to suit their requirements using Serilog. Enable custom logging by setting useCustomConfig: true in config.yaml and providing a logging.json file in the configuration directory. Note that enabling useCustomConfig disables the standard server and access logging settings in config.yaml.

logging:
  useCustomConfig: true

Any library dependencies not included in the release — including their transitive dependencies — must be copied from sources such as nuget.org into the installation directory (where the other Serilog.*.dll files are located). Special care should be taken to ensure that the provided DLL files are compatible with the installed version of Serilog and any existing libraries.

Replacing existing Serilog.*.dll files with different versions is sometimes possible but not recommended, as it may lead to application instability or failures.

Access logs are identified by the Access Serilog property.

Configuration example

This example demonstrates how to configure Serilog to write logs to a file, output them to the console, and send error messages to an email address.

Since Serilog.Sinks.Email is not included in the release, it must be added manually along with all its required dependencies:

{
  "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"
        }
      }
    ]
  }
}

NuGet versions

Changes since the previous version are marked in bold.

LibraryBuru 2.5.1+Buru 2.6.0+Buru 2.7.2+Buru 2.9.3+Buru 2.16.0+
.NETnetcoreapp3.1net6.0net6.0net6.0net8.0
Serilog2.102.102.112.124.1
Serilog.Extensions.Hosting4.1.24.25.0.17.08.0
Serilog.Extensions.Logging3.13.13.17.08.0
Serilog.Formatting.Compact1.11.11.11.13.0
Serilog.Settings.Configuration3.33.33.37.08.0
Serilog.Sinks.ColoredConsole3.0.13.0.13.0.13.0.1
Serilog.Sinks.Console4.04.0.14.0.14.16.0
Serilog.Sinks.Debug2.02.02.02.03.0
Serilog.Sinks.EventLog3.13.13.13.14.0
Serilog.Sinks.File5.05.05.05.06.0
Serilog.Sinks.RollingFile3.33.33.33.3
Serilog.Sinks.TextWriter2.12.12.12.13.0

On this page