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:
- In the Web Admin interface, click Logging.
- Define the Directory and Keep at most for both Server and Access logs.
- Select the Minimum log level from the dropdown menu. (default is Warning)
- Click Save and restart.
To configure server logging using the config.yaml file, follow these steps:
- Open the
config.yamlfile. - In the
loggingsection, configure theserverandaccesslogs: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 - Set log levels and retention with the following parameters:
minLevel: Specifies the minimum log level to record. Options:verbose,debug,information,warning,errorandfatal. For more details, see theconfig.yaml loggingguide.maxFileCount: Defines the maximum number of log files to keep. The oldest files are deleted once this limit is reached. Set to0to disable deletion.
Restart the service
Restart the Buru SFTP service for the changes to take effect:
services.msc, find Rebex Buru SFTP Server, right-click and select Restart.burusftp svc restartnet stop RebexBuruSftp && net start RebexBuruSftpRestart-Service RebexBuruSftpPermissions
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.
-
Open the
webconfig.yamlfile and locate theloggingsection. 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: 31Permissions
The Web Administration service user must have write access to the specified log location.
-
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: trueAny 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.Sinks.EmailSerilog.Sinks.PeriodicBatching(dependency ofSerilog.Sinks.Email)Mailkit(dependency ofSerilog.Sinks.Email)
{
"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.
| Library | Buru 2.5.1+ | Buru 2.6.0+ | Buru 2.7.2+ | Buru 2.9.3+ | Buru 2.16.0+ |
|---|---|---|---|---|---|
| .NET | netcoreapp3.1 | net6.0 | net6.0 | net6.0 | net8.0 |
| Serilog | 2.10 | 2.10 | 2.11 | 2.12 | 4.1 |
| 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 | — |
| 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 | 3.0 |
| Serilog.Sinks.EventLog | 3.1 | 3.1 | 3.1 | 3.1 | 4.0 |
| Serilog.Sinks.File | 5.0 | 5.0 | 5.0 | 5.0 | 6.0 |
| Serilog.Sinks.RollingFile | 3.3 | 3.3 | 3.3 | 3.3 | — |
| Serilog.Sinks.TextWriter | 2.1 | 2.1 | 2.1 | 2.1 | 3.0 |