![]() |
VOOZH | about |
dotnet add package Serilog.Sinks.AzureTableStorage --version 10.2.0
NuGet\Install-Package Serilog.Sinks.AzureTableStorage -Version 10.2.0
<PackageReference Include="Serilog.Sinks.AzureTableStorage" Version="10.2.0" />
<PackageVersion Include="Serilog.Sinks.AzureTableStorage" Version="10.2.0" />Directory.Packages.props
<PackageReference Include="Serilog.Sinks.AzureTableStorage" />Project file
paket add Serilog.Sinks.AzureTableStorage --version 10.2.0
#r "nuget: Serilog.Sinks.AzureTableStorage, 10.2.0"
#:package Serilog.Sinks.AzureTableStorage@10.2.0
#addin nuget:?package=Serilog.Sinks.AzureTableStorage&version=10.2.0Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.AzureTableStorage&version=10.2.0Install as a Cake Tool
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 | 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 |
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.
<appSettings> configurationTo 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>
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)
{
}
}
10.0.0
IBatchedLogEventSink9.6.0
9.5.0
9.4.0
9.1.0
9.0.0
IDocumentFactory.Create add AzureTableStorageSinkOptions and IKeyGenerator argumentsIKeyGenerator.GeneratePartitionKey add AzureTableStorageSinkOptions argumentIKeyGenerator.GenerateRowKey add AzureTableStorageSinkOptions argument8.5.0
8.0.0
7.0.0
6.0.0
5.0.0
1.5
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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. |
|
|
Indiko.Blocks.Logging.Serilog
Building Blocks Logging Serilog |
|
|
BumperLane.Hosted.Api.V2.Application
BumperLane Core API functionality |
|
|
AzureWebFarm.OctopusDeploy
Scalable, OctopusDeploy-powered webfarm using Windows Azure Web Roles. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.2.0 | 179,317 | 8/28/2025 |
| 10.1.0 | 242,989 | 1/16/2025 |
| 10.0.2 | 111,332 | 10/26/2024 |
| 10.0.1 | 150,597 | 7/26/2024 |
| 10.0.0 | 28,546 | 7/10/2024 |
| 10.0.0-beta.1 | 2,264 | 6/3/2024 |
| 9.7.1 | 162,088 | 5/29/2024 |
| 9.7.0 | 15,808 | 5/10/2024 |
| 9.6.0 | 71,037 | 4/26/2024 |
| 9.5.0 | 46,888 | 4/10/2024 |
| 9.4.1 | 41,548 | 3/10/2024 |
| 9.3.0 | 4,588 | 3/6/2024 |
| 9.2.0 | 111,672 | 12/11/2023 |
| 9.1.0 | 34,210 | 11/9/2023 |
| 9.0.0 | 113,980 | 8/6/2023 |
| 9.0.0-beta.2 | 256 | 8/1/2023 |
| 9.0.0-beta.1.1 | 264 | 8/1/2023 |
| 8.5.42-alpha.0.7 | 253 | 8/1/2023 |
| 8.5.41 | 48,882 | 6/24/2023 |
| 8.5.39-beta | 738 | 6/24/2023 |