Serilog.Sinks.AmazonS3.Uploader
1.0.0
See the version list below for details.
dotnet add package Serilog.Sinks.AmazonS3.Uploader --version 1.0.0
NuGet\Install-Package Serilog.Sinks.AmazonS3.Uploader -Version 1.0.0
<PackageReference Include="Serilog.Sinks.AmazonS3.Uploader" Version="1.0.0" />
paket add Serilog.Sinks.AmazonS3.Uploader --version 1.0.0
#r "nuget: Serilog.Sinks.AmazonS3.Uploader, 1.0.0"
// Install Serilog.Sinks.AmazonS3.Uploader as a Cake Addin
#addin nuget:?package=Serilog.Sinks.AmazonS3.Uploader&version=1.0.0
// Install Serilog.Sinks.AmazonS3.Uploader as a Cake Tool
#tool nuget:?package=Serilog.Sinks.AmazonS3.Uploader&version=1.0.0
A Serilog sink sending log files to Amazon S3
Serilog.Sinks.AmazonS3.Uploader
Package - Serilog.Sinks.AmazonS3.Uploader | Platforms - NET 5.0
Installation
If you want to include the sink in your project, you can install it directly from NuGet.
To install the sink, run the following command in the Package Manager Console:
PM> Install-Package Serilog.Sinks.AmazonS3.Uploader
Use cases
This sink should be used when you already have a process which is producing your log files and you want to upload these files to S3 for archiving. Once file is uploaded - it is deleted from original location.
NOTE: this process heavily depends on file locking. Normally serilog keeps current file locked and prevents access to it. So file cannot be uploaded while file is locked. However when file is rolled over (by time or size limitations) it is unlocked. Then this sink is able to upload the file to S3.
Usage
In the following example the sink will read files in specified directory (c:/temp/logs) and sends them to S3 bucket (application-logs). Please note that it should exists another logger which produces log files and AmazonS3.Uploader does not write any local files nor it collects log events.
Used in conjunction with Serilog.Settings.Configuration the same sink can be configured in the following way:
{
"Serilog": {
"MinimumLevel": {"Default": "Debug"},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "c:/temp/logs/application.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": "104857600",
"rollOnFileSizeLimit": true
}
},
{
"Name": "S3",
"Args": {
"logFileFolder": "c:/temp/logs",
"bucketName": "application-logs",
"accessKey": "",
"secretKey": "",
"region": "eu-west-1",
"s3Path": "dev/%timestamp%/application",
"filePrefix": "machine-name",
"period": "01:00:00"
}
}
]
},
}
Parameters
- logFileFolder > folder to watch for available files
- bucketName > S3 bucket name where to upload files
- accessKey > Amazon access key
- secretKey > Amazon secret key
- region > S3 bucket region
- s3Path > folder inside S3 where to put uploaded files
- %timestamp% - formats file last write time as
yyyyMM
- %timestamp% - formats file last write time as
- filePrefix > adds a prefix to a file, usefull when multiple instances of the same service are running, in that case prefix should be uniquely identifying instance
- period > defines how often to check for available files
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- AWSSDK.S3 (>= 3.7.3.4)
- Serilog (>= 2.10.0)
- System.Threading.Channels (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.