Serilog.Sinks.AzureTableStorage
10.0.1
See the version list below for details.
dotnet add package Serilog.Sinks.AzureTableStorage --version 10.0.1
NuGet\Install-Package Serilog.Sinks.AzureTableStorage -Version 10.0.1
<PackageReference Include="Serilog.Sinks.AzureTableStorage" Version="10.0.1" />
paket add Serilog.Sinks.AzureTableStorage --version 10.0.1
#r "nuget: Serilog.Sinks.AzureTableStorage, 10.0.1"
// Install Serilog.Sinks.AzureTableStorage as a Cake Addin #addin nuget:?package=Serilog.Sinks.AzureTableStorage&version=10.0.1 // Install Serilog.Sinks.AzureTableStorage as a Cake Tool #tool nuget:?package=Serilog.Sinks.AzureTableStorage&version=10.0.1
Serilog.Sinks.AzureTableStorage
Writes to a table in Azure Table Storage.
Package - Serilog.Sinks.AzureTableStorage | Platforms - .NET Standard 2.0
var log = new LoggerConfiguration()
.WriteTo.AzureTableStorage("<connectionString>")
.CreateLogger();
Configuration
Configuration | Description | Default |
---|---|---|
connectionString | The Cloud Storage Account connection string | |
sharedAccessSignature | The storage account/table SAS key | |
accountName | The storage account name | |
restrictedToMinimumLevel | The minimum log event level required in order to write an event to the sink. | Verbose |
formatProvider | Culture-specific formatting information | |
storageTableName | Table name that log entries will be written to | LogEvent |
batchPostingLimit | The maximum number of events to post in a single batch | 100 |
period | The time to wait between checking for event batches | 0:0:2 |
keyGenerator | The key generator used to create the PartitionKey and the RowKey for each log entry | DefaultKeyGenerator |
propertyColumns | Specific log event properties to be written as table columns | |
bypassTableCreationValidation | Bypass the exception in case the table creation fails | false |
documentFactory | Provider to create table document from LogEvent | DefaultDocumentFactory |
tableClientFactory | Provider to create table client | DefaultTableClientFactory |
partitionKeyRounding | Partition key rounding time span | 0:5:0 |
JSON configuration
It is possible to configure the sink using Serilog.Settings.Configuration by specifying the table name and connection string in appsettings.json
:
"Serilog": {
"WriteTo": [
{"Name": "AzureTableStorage", "Args": {"storageTableName": "", "connectionString": ""}}
]
}
JSON configuration must be enabled using ReadFrom.Configuration()
; see the documentation of the JSON configuration package for details.
XML <appSettings>
configuration
To use the file sink with the Serilog.Settings.AppSettings package, first install that package if you haven't already done so:
Install-Package Serilog.Settings.AppSettings
Instead of configuring the logger in code, call ReadFrom.AppSettings()
:
var log = new LoggerConfiguration()
.ReadFrom.AppSettings()
.CreateLogger();
In your application's App.config
or Web.config
file, specify the file sink assembly and required path format under the <appSettings>
node:
<configuration>
<appSettings>
<add key="serilog:using:AzureTableStorage" value="Serilog.Sinks.AzureTableStorage" />
<add key="serilog:write-to:AzureTableStorage.connectionString" value="DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=KEY;EndpointSuffix=core.windows.net" />
<add key="serilog:write-to:AzureTableStorage.formatter" value="Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />
</appSettings>
</configuration>
Example Configuration for ASP.NET
public static class Program
{
private const string OutputTemplate = "{Timestamp:HH:mm:ss.fff} [{Level:u1}] {Message:lj}{NewLine}{Exception}";
public static async Task<int> Main(string[] args)
{
// azure home directory
var homeDirectory = Environment.GetEnvironmentVariable("HOME") ?? ".";
var logDirectory = Path.Combine(homeDirectory, "LogFiles");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.Console(outputTemplate: OutputTemplate)
.WriteTo.File(
path: $"{logDirectory}/boot.txt",
rollingInterval: RollingInterval.Day,
shared: true,
flushToDiskInterval: TimeSpan.FromSeconds(1),
outputTemplate: OutputTemplate,
retainedFileCountLimit: 10
)
.CreateBootstrapLogger();
try
{
Log.Information("Starting web host");
var builder = Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(args);
builder.Host
.UseSerilog((context, services, configuration) => configuration
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.Enrich.WithProperty("ApplicationName", builder.Environment.ApplicationName)
.Enrich.WithProperty("EnvironmentName", builder.Environment.EnvironmentName)
.WriteTo.Console(outputTemplate: OutputTemplate)
.WriteTo.File(
path: $"{logDirectory}/log.txt",
rollingInterval: RollingInterval.Day,
shared: true,
flushToDiskInterval: TimeSpan.FromSeconds(1),
outputTemplate: OutputTemplate,
retainedFileCountLimit: 10
)
.WriteTo.AzureTableStorage(
connectionString: context.Configuration.GetConnectionString("StorageAccount"),
propertyColumns: new[] { "SourceContext", "RequestId", "RequestPath", "ConnectionId", "ApplicationName", "EnvironmentName" }
)
);
ConfigureServices(builder);
var app = builder.Build();
ConfigureMiddleware(app);
await app.RunAsync();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
return 1;
}
finally
{
await Log.CloseAndFlushAsync();
}
}
private static void ConfigureServices(WebApplicationBuilder builder)
{
}
private static void ConfigureMiddleware(Microsoft.AspNetCore.Builder.WebApplication app)
{
}
}
Change Log
10.0.0
- Breaking: writeInBatches removed, all writes are now batched
- Update: update to serilog 4.0
- Remove: removed dependance on Serilog.Sinks.PeriodicBatching, use serilog 4.0
IBatchedLogEventSink
9.6.0
- Fix: improve timezone support
9.5.0
- Add: use ULID for rowkey for speed and efficiency
9.4.0
- Fix: prevent duplicate rowkey
9.1.0
- Add: Built-in trace and span id support
9.0.0
- Breaking: Due to issue with creating provides from configuration
IDocumentFactory.Create
add AzureTableStorageSinkOptions and IKeyGenerator argumentsIKeyGenerator.GeneratePartitionKey
add AzureTableStorageSinkOptions argumentIKeyGenerator.GenerateRowKey
add AzureTableStorageSinkOptions argument
- Fix: DefaultDocumentFactory and DefaultKeyGenerator needed paramaterless contructor for use in configuration files
- Add: ITableClientFactory to control TableClient creation
8.5.0
- Add option for partition key rounding
- Move IKeyGenertor from options
- Add DateTime extension methods for partition key and row key
- Add sample web project
8.0.0
- Breaking: major refactor to simplify code base
- Removed: AzureTableStorageWithProperties extension removed, use equivalent AzureTableStorage
- Removed: ICloudTableProvider provider removed
- Added: IDocumentFactory to allow control over table document
- Change: PartitionKey and RowKey changed to new implementation
7.0.0
- Update dependencies: repace Microsoft.Azure.Cosmos.Table with Azure.Data.Tables
6.0.0
- Updated dependencies: replace deprecated package WindowsAzure.Storage with Microsoft.Azure.Cosmos.Table 1.0.8
- Updated dependencies: Serilog 2.10.0
5.0.0
- Migrated to new CSPROJ project system
- Updated dependencies: WindowsAzure.Storage 8.6.0, Serilog 2.6.0, Serilog.Sinks.PeriodicBatching 2.1.1
- Fix #36 - Allow using SAS URI for logging.
1.5
- Moved from serilog/serilog
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. 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. |
-
.NETStandard 2.0
- Azure.Data.Tables (>= 12.9.0)
- Serilog (>= 4.0.1)
- ulid (>= 1.3.3)
-
.NETStandard 2.1
- Azure.Data.Tables (>= 12.9.0)
- Serilog (>= 4.0.1)
- ulid (>= 1.3.3)
-
net6.0
- Azure.Data.Tables (>= 12.9.0)
- Serilog (>= 4.0.1)
- ulid (>= 1.3.3)
-
net8.0
- Azure.Data.Tables (>= 12.9.0)
- Serilog (>= 4.0.1)
- ulid (>= 1.3.3)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Serilog.Sinks.AzureTableStorage:
Package | Downloads |
---|---|
TouchConvert.Tenant.Api.V1.Dtos
Data transfer objects for TouchConvert version one APIs. |
|
TouchConvert.Tenant.Api.V2.Dtos
Data transfer objects for TouchConvert version two APIs. |
|
BumperLane.Hosted.Api.V2.Application
BumperLane Core API functionality |
|
AzureWebFarm.OctopusDeploy
Scalable, OctopusDeploy-powered webfarm using Windows Azure Web Roles. |
|
LittleBlocks.Azure.Serilog
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
10.0.2 | 5,925 | 10/26/2024 |
10.0.1 | 38,405 | 7/26/2024 |
10.0.0 | 12,832 | 7/10/2024 |
10.0.0-beta.1 | 698 | 6/3/2024 |
9.7.1 | 57,630 | 5/29/2024 |
9.7.0 | 8,362 | 5/10/2024 |
9.6.0 | 33,291 | 4/26/2024 |
9.5.0 | 23,702 | 4/10/2024 |
9.4.1 | 16,959 | 3/10/2024 |
9.3.0 | 2,251 | 3/6/2024 |
9.2.0 | 61,315 | 12/11/2023 |
9.1.0 | 18,421 | 11/9/2023 |
9.0.0 | 73,502 | 8/6/2023 |
9.0.0-beta.2 | 126 | 8/1/2023 |
9.0.0-beta.1.1 | 121 | 8/1/2023 |
8.5.42-alpha.0.7 | 116 | 8/1/2023 |
8.5.41 | 40,481 | 6/24/2023 |
8.5.39-beta | 580 | 6/24/2023 |
8.5.38 | 83,757 | 5/8/2023 |
8.5.36-beta | 623 | 5/2/2023 |
8.0.35 | 5,738 | 4/16/2023 |
8.0.33-beta | 547 | 4/16/2023 |
8.0.31-beta | 618 | 4/16/2023 |
8.0.30-beta | 605 | 4/11/2023 |
8.0.28-beta | 643 | 4/10/2023 |
8.0.27-beta | 659 | 3/27/2023 |
7.0.25 | 37,056 | 3/25/2023 |
7.0.22-beta | 667 | 3/25/2023 |
6.0.0-dev-00146 | 19,075 | 4/29/2021 |
5.0.0 | 1,384,226 | 7/28/2020 |
5.0.0-dev-00116 | 94,131 | 9/8/2018 |
5.0.0-dev-00111 | 2,485 | 9/4/2018 |
5.0.0-dev-00109 | 1,203 | 9/4/2018 |
5.0.0-dev-00105 | 8,059 | 5/9/2018 |
5.0.0-dev-00101 | 1,442 | 4/24/2018 |
5.0.0-dev-00093 | 6,733 | 3/20/2018 |
4.0.0 | 1,599,975 | 6/13/2017 |
4.0.0-dev-00089 | 1,586 | 5/22/2017 |
4.0.0-dev-00082 | 4,759 | 3/14/2017 |
4.0.0-dev-00079 | 1,591 | 3/4/2017 |
4.0.0-dev-00077 | 1,461 | 3/1/2017 |
4.0.0-dev-00074 | 1,378 | 2/28/2017 |
4.0.0-dev-00069 | 2,832 | 2/13/2017 |
3.0.1-dev-00067 | 2,887 | 2/3/2017 |
3.0.0 | 197,166 | 11/22/2016 |
3.0.0-dev-00055 | 1,480 | 10/14/2016 |
3.0.0-dev-00052 | 1,396 | 10/7/2016 |
3.0.0-dev-00045 | 2,356 | 10/6/2016 |
3.0.0-dev-00044 | 2,543 | 10/3/2016 |
3.0.0-dev-00039 | 1,584 | 10/3/2016 |
2.0.1-dev-00030 | 2,479 | 7/19/2016 |
2.0.0 | 56,874 | 6/29/2016 |
2.0.0-beta-20 | 2,444 | 4/26/2016 |
1.5.14 | 36,578 | 4/17/2016 |
1.5.11 | 12,771 | 12/26/2015 |
1.5.5 | 32,604 | 4/2/2015 |
1.5.4 | 3,069 | 4/2/2015 |
1.5.3 | 1,803 | 4/1/2015 |
1.5.2 | 2,574 | 3/30/2015 |
1.5.1 | 1,735 | 3/27/2015 |
1.4.196 | 2,465 | 2/22/2015 |
1.4.182 | 2,027 | 2/15/2015 |
1.4.168 | 1,964 | 2/8/2015 |
1.4.155 | 1,849 | 2/1/2015 |
1.4.139 | 1,715 | 1/23/2015 |
1.4.118 | 1,851 | 1/13/2015 |
1.4.113 | 2,017 | 1/6/2015 |
1.4.102 | 2,307 | 12/21/2014 |
1.4.99 | 2,154 | 12/18/2014 |
1.4.97 | 2,050 | 12/18/2014 |
1.4.76 | 2,054 | 12/8/2014 |
1.4.75 | 2,022 | 12/7/2014 |
1.4.39 | 1,935 | 11/26/2014 |
1.4.34 | 1,883 | 11/24/2014 |
1.4.28 | 1,885 | 11/24/2014 |
1.4.27 | 1,993 | 11/23/2014 |
1.4.23 | 2,040 | 11/21/2014 |
1.4.22 | 1,920 | 11/21/2014 |
1.4.21 | 1,894 | 11/21/2014 |
1.4.18 | 2,060 | 11/18/2014 |
1.4.15 | 2,261 | 11/4/2014 |
1.4.14 | 1,860 | 10/23/2014 |
1.4.13 | 1,814 | 10/23/2014 |
1.4.12 | 1,917 | 10/12/2014 |
1.4.11 | 1,743 | 10/8/2014 |
1.4.10 | 2,553 | 9/26/2014 |
1.4.9 | 1,880 | 9/17/2014 |
1.4.8 | 1,873 | 9/11/2014 |
1.4.7 | 2,440 | 9/1/2014 |
1.4.6 | 1,818 | 8/31/2014 |
1.4.5 | 1,743 | 8/27/2014 |
1.4.4 | 1,829 | 8/27/2014 |
1.4.3 | 2,749 | 8/25/2014 |
1.4.2 | 1,683 | 8/23/2014 |
1.4.1 | 1,712 | 8/23/2014 |
1.3.43 | 1,871 | 8/4/2014 |
1.3.42 | 1,749 | 7/30/2014 |
1.3.41 | 1,744 | 7/28/2014 |
1.3.40 | 1,752 | 7/26/2014 |
1.3.39 | 1,815 | 7/25/2014 |
1.3.37 | 1,772 | 7/25/2014 |
1.3.36 | 1,789 | 7/20/2014 |
1.3.35 | 1,757 | 7/17/2014 |
1.3.34 | 1,731 | 7/6/2014 |
1.3.33 | 1,756 | 6/30/2014 |
1.3.30 | 1,767 | 6/19/2014 |
1.3.29 | 1,755 | 6/19/2014 |
1.3.28 | 1,777 | 6/19/2014 |
1.3.27 | 1,762 | 6/18/2014 |
1.3.26 | 1,763 | 6/18/2014 |
1.3.25 | 1,795 | 6/9/2014 |
1.3.24 | 1,792 | 5/21/2014 |
1.3.23 | 1,740 | 5/20/2014 |
1.3.20 | 1,840 | 5/18/2014 |
1.3.19 | 1,785 | 5/17/2014 |
1.3.18 | 1,756 | 5/17/2014 |
1.3.17 | 1,763 | 5/17/2014 |
1.3.16 | 1,734 | 5/17/2014 |
1.3.15 | 1,770 | 5/16/2014 |
1.3.14 | 1,760 | 5/16/2014 |
1.3.13 | 1,741 | 5/16/2014 |
1.3.12 | 1,724 | 5/14/2014 |
1.3.7 | 1,759 | 5/11/2014 |
1.3.6 | 1,775 | 5/9/2014 |
1.3.5 | 1,807 | 5/6/2014 |
1.3.4 | 1,738 | 5/4/2014 |
1.3.3 | 1,871 | 4/28/2014 |
1.3.1 | 2,045 | 4/26/2014 |
1.2.53 | 1,862 | 4/26/2014 |
1.2.52 | 1,906 | 4/24/2014 |
1.2.51 | 1,982 | 4/18/2014 |
1.2.50 | 1,973 | 4/18/2014 |
1.2.49 | 1,889 | 4/17/2014 |
1.2.48 | 1,990 | 4/14/2014 |
1.2.47 | 1,957 | 4/14/2014 |
1.2.45 | 1,956 | 4/13/2014 |
1.2.44 | 1,980 | 4/9/2014 |
1.2.41 | 2,232 | 4/7/2014 |
1.2.40 | 1,845 | 4/7/2014 |
1.2.39 | 2,268 | 3/29/2014 |
1.2.38 | 1,855 | 3/29/2014 |
1.2.37 | 1,903 | 3/29/2014 |
1.2.29 | 2,126 | 3/16/2014 |
1.2.27 | 1,849 | 3/14/2014 |
1.2.26 | 1,817 | 3/12/2014 |
1.2.25 | 3,534 | 2/20/2014 |
0.9.9 | 2,579 | 11/23/2013 |
0.9.1 | 2,656 | 8/24/2013 |
0.8.6 | 1,975 | 7/29/2013 |
0.8.5 | 2,074 | 7/22/2013 |
0.8.1 | 2,095 | 7/9/2013 |
0.7.2 | 2,072 | 7/6/2013 |
0.6.1 | 1,988 | 6/13/2013 |
0.5.2 | 2,033 | 5/27/2013 |
0.5.1 | 1,923 | 5/26/2013 |
0.4.3 | 2,282 | 5/25/2013 |