HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 1.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 --version 1.0.0
NuGet\Install-Package HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 --version 1.0.0
#r "nuget: HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 as a Cake Addin
#addin nuget:?package=HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3&version=1.0.0

// Install HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3 as a Cake Tool
#tool nuget:?package=HaemmerElectronics.SeppPenner.Serilog.Sinks.AmazonS3&version=1.0.0

Serilog.Sinks.AmazonS3

Serilog.Sinks.AmazonS3 is a library to save logging information from Serilog to Amazon S3. The idea there was to upload log files to Amazon S3 to later evaluate them with Amazon EMR services. The assembly was written and tested in .Net Framework 4.8 and .Net Standard 2.0. This project makes use of the Serilog.Sinks.File's code in a major part, so thanks to all the contributors of this project 👍.

Build status GitHub issues GitHub forks GitHub stars GitHub license Nuget NuGet Downloads Known Vulnerabilities

Available for

  • NetFramework 4.5
  • NetFramework 4.6
  • NetFramework 4.6.2
  • NetFramework 4.7
  • NetFramework 4.7.2
  • NetFramework 4.8
  • NetStandard 2.0

Basic usage:

var logger = new LoggerConfiguration().WriteTo
    .AmazonS3(
        "log.txt",
        "mytestbucket-aws",
        Amazon.RegionEndpoint.EUWest2,
        "ABCDEFGHIJKLMNOP",
        "c3fghsrgwegfn://asdfsdfsdgfsdg",
        fileSizeLimitBytes: 200,
        rollingInterval: RollingInterval.Minute)
    .CreateLogger();

    for (var x = 0; x < 200; x++)
    {
        var ex = new Exception("Test");
        logger.Error(ex.ToString());
    }

The project can be found on nuget.

Configuration options:

|Parameter|Meaning|Example|Default value| |-|-|-|-| |path|The main log file name used.|"log.txt"|None, is mandatory.| |bucketName|The name of the Amazon S3 bucket to use. Check: https://docs.aws.amazon.com/general/latest/gr/rande.html.|`"mytestbucket-aws"`|None, is mandatory.| |endpoint|The Amazon S3 endpoint location.|RegionEndpoint.EUWest2|None, is mandatory.| |awsAccessKeyId|The Amazon S3 access key id.|ABCDEFGHIJKLMNOP|None, is mandatory.| |awsSecretAccessKey|The Amazon S3 secret access key.|c3fghsrgwegfn://asdfsdfsdgfsdg|None, is mandatory.| |restrictedToMinimumLevel|The minimum level for events passed through the sink. Ignored when levelSwitch is specified. Check: https://github.com/serilog/serilog/blob/dev/src/Serilog/Events/LogEventLevel.cs.|`LogEventLevel.Information`|`LogEventLevel.Verbose`| |outputTemplate|A message template describing the format used to write to the sink.|"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}"|"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}"| |formatProvider|The IFormatProvider to use. Supplies culture-specific formatting information. Check: https://docs.microsoft.com/en-us/dotnet/api/system.iformatprovider?view=netframework-4.8.|`new CultureInfo("de-DE")|null| |fileSizeLimitBytes|The number of bytes in a file. The sink rolls to a new file after the limit is reached.|200|1L * 1024 * 1024 * 1024| |levelSwitch|A switch allowing the pass-through minimum level to be changed at runtime. Check: https://nblumhardt.com/2014/10/dynamically-changing-the-serilog-level/.|var levelSwitch = new LoggingLevelSwitch(); levelSwitch.MinimumLevel = LogEventLevel.Warning;|null| |buffered|Indicates if flushing to the output file can be buffered or not.|buffered: true|false| |rollingInterval|The interval at which logging will roll over to a new file. Check: https://github.com/serilog/serilog-sinks-file/blob/dev/src/Serilog.Sinks.File/RollingInterval.cs.|rollingInterval: RollingInterval.Minute|RollingInterval.Day| |retainedFileCountLimit|The maximum number of log files that will be retained, including the current log file. For unlimited retention, pass null.|10|31| |encoding|Character encoding used to write the text file. Check: https://docs.microsoft.com/de-de/dotnet/api/system.text.encoding?view=netframework-4.8.|encoding: Encoding.Unicode|nullmeaningEncoding.UTF8| |hooks|Optionally enables hooking into log file lifecycle events. Check: https://github.com/serilog/serilog-sinks-file/blob/dev/src/Serilog.Sinks.File/Sinks/File/FileLifecycleHooks.cs and https://github.com/cocowalla/serilog-sinks-file-header/blob/master/src/Serilog.Sinks.File.Header/HeaderWriter.cs.|hooks: new HeaderWriter("Timestamp,Level,Message")|null`|

Full example

var levelSwitch = new LoggingLevelSwitch();
levelSwitch.MinimumLevel = LogEventLevel.Warning;

var logger = new LoggerConfiguration().WriteTo
    .AmazonS3(
        "log.txt",
        "mytestbucket-aws",
        Amazon.RegionEndpoint.EUWest2,
        "ABCDEFGHIJKLMNOP",
        "c3fghsrgwegfn://asdfsdfsdgfsdg",
        restrictedToMinimumLevel:LogEventLevel.Verbose,
        outputTemplate:"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
        new CultureInfo("de-DE"),
        fileSizeLimitBytes: 200,
        levelSwitch: levelSwitch,
        buffered: true,
        rollingInterval: RollingInterval.Minute,
        retainedFileCountLimit: 10,
        encoding: Encoding.Unicode,
        hooks: new HeaderWriter("Timestamp,Level,Message"))
    .CreateLogger();

    for (var x = 0; x < 200; x++)
    {
        var ex = new Exception("Test");
        logger.Error(ex.ToString());
    }

Change history

  • Version 1.0.0.0 (2019-05-31) : 1.0 release.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 is compatible.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.10 34,641 8/29/2021
1.1.9 3,345 8/9/2021
1.1.8 6,347 7/25/2021
1.1.7 2,040 6/4/2021
1.1.6 799 5/15/2021
1.1.5 1,228 4/29/2021
1.1.4 1,466 4/7/2021
1.1.3 21,801 3/31/2021
1.1.2 8,068 2/27/2021
1.1.1 394 2/21/2021
1.1.0 1,383 2/3/2021
1.0.12 31,365 7/16/2020
1.0.11 426 7/15/2020
1.0.10 9,359 6/5/2020
1.0.9 23,751 5/10/2020
1.0.8 8,930 3/26/2020
1.0.7 629 2/9/2020
1.0.6 3,988 12/9/2019
1.0.5 530 12/8/2019
1.0.4 2,041 11/12/2019
1.0.3 561 11/8/2019
1.0.2 861 7/25/2019
1.0.1 691 6/23/2019
1.0.0 2,300 6/1/2019

Version 1.0.0.0 (2019-05-31): 1.0 release.