Elastic.Ingest.Elasticsearch.CommonSchema
8.12.2
Prefix Reserved
dotnet add package Elastic.Ingest.Elasticsearch.CommonSchema --version 8.12.2
NuGet\Install-Package Elastic.Ingest.Elasticsearch.CommonSchema -Version 8.12.2
<PackageReference Include="Elastic.Ingest.Elasticsearch.CommonSchema" Version="8.12.2" />
paket add Elastic.Ingest.Elasticsearch.CommonSchema --version 8.12.2
#r "nuget: Elastic.Ingest.Elasticsearch.CommonSchema, 8.12.2"
// Install Elastic.Ingest.Elasticsearch.CommonSchema as a Cake Addin #addin nuget:?package=Elastic.Ingest.Elasticsearch.CommonSchema&version=8.12.2 // Install Elastic.Ingest.Elasticsearch.CommonSchema as a Cake Tool #tool nuget:?package=Elastic.Ingest.Elasticsearch.CommonSchema&version=8.12.2
Elastic.Ingest.Elasticsearch.CommonSchema
A specialization of Elastic.Ingest.Elasticsearch
that offers two channel implementations that make it easy to write ECS formatted data and bootstrap the target datastreams/indices with ECS mappings and settings.
EcsDataStreamChannel<TEvent>
A channel that specializes to writing data with a timestamp to Elasticsearch data streams.
A channel can be created to push data to the logs-dotnet-default
data stream.
var dataStream = new DataStreamName("logs", "dotnet");
var bufferOptions = new BufferOptions { }
var options = new DataStreamChannelOptions<EcsDocument>(transport)
{
DataStream = dataStream,
BufferOptions = bufferOptions
};
var channel = new EcsDataStreamChannel<EcsDocument>(options);
NOTE: read more about Elastic's data stream naming convention here: https://www.elastic.co/blog/an-introduction-to-the-elastic-data-stream-naming-scheme
we can now push data to Elasticsearch using the EcsDataStreamChannel
var doc = new EcsDocument
{
Timestamp = DateTimeOffset.Now,
Message = "Hello World!",
}
channel.TryWrite(doc);
EcsIndexChannel<TEvent>
A channel that specializes in writing catalog data to Elastic indices.
We can create an EcsIndexChannel<>
to push EcsDocument
(or subclassed) instances.
var options = new IndexChannelOptions<EcsDocument>(transport)
{
IndexFormat = "catalog-data-{0:yyyy.MM.dd}",
// BulkOperationIdLookup = c => null,
TimestampLookup = c => c.Timestamp,
};
var channel = new EcsIndexChannel<CatalogDocument>(options);
now we can push data using:
var doc = new CatalogDocument
{
Created = date,
Title = "Hello World!",
Id = "hello-world"
}
channel.TryWrite(doc);
This will push data to catalog-data-2023.01.1
because TimestampLookup
yields Timestamp
to IndexFormat
.
IndexFormat
can also simply be a fixed string to write to an Elasticsearch alias/index.
BulkOperationIdLookup
determines if the document should be pushed to Elasticsearch using a create
or index
operation.
Bootstrapping target Datastream or Index
Optionally the target data stream or index can be bootstrapped using the following.
await channel.BootstrapElasticsearchAsync(BootstrapMethod.Failure, "7-days-default");
This will bootstrap:
- Set up component templates for all ECS fieldsets
- Create a special
*-settings
component template for the datastream/indices that sets up ILM. - Set up an index template for the target datastream or indices.
If the index template already exists no further bootstrapping will occur.
Just like Elastic.Ingest.Elasticsearch
the channel is aware that logs
and metrics
have default component templates and ensures the new index tempate references them.
Product | Versions 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 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
- Elastic.CommonSchema (>= 8.12.2)
- Elastic.Ingest.Elasticsearch (>= 0.7.2)
-
.NETStandard 2.1
- Elastic.CommonSchema (>= 8.12.2)
- Elastic.Ingest.Elasticsearch (>= 0.7.2)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Elastic.Ingest.Elasticsearch.CommonSchema:
Package | Downloads |
---|---|
Elastic.Serilog.Sinks
Package Description |
|
Elastic.CommonSchema.BenchmarkDotNetExporter
Exports BenchmarkDotNet benchmarks to Elasticsearch using Elastic Common Schema (ECS) format |
|
Elastic.Extensions.Logging
Elasticsearch logger provider for Microsoft.Extensions.Logging. Writes direct to Elasticsearch using the Elastic Common Schema (ECS), with semantic logging of structured data from message and scope values, for use with the Elasticsearch-Logstash-Kibana (ELK) stack. The results can be viewed and queried in the Kibana console. |
|
Elasticsearch.Extensions.Logging
Elasticsearch logger provider for Microsoft.Extensions.Logging. Writes direct to Elasticsearch using the Elastic Common Schema (ECS), with semantic logging of structured data from message and scope values, for use with the Elasticsearch-Logstash-Kibana (ELK) stack. The results can be viewed and queried in the Kibana console. |
|
Elastic.NLog.Targets
NLog Target that exports directly to Elastic Cloud or individual Elasticsearch nodes |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.12.2 | 53,690 | 10/22/2024 |
8.12.1 | 49,095 | 10/3/2024 |
8.12.0 | 19,718 | 9/26/2024 |
8.11.1 | 316,632 | 6/10/2024 |
8.11.0 | 117,948 | 4/10/2024 |
8.6.1 | 579,729 | 8/3/2023 |
8.6.0 | 100,714 | 5/9/2023 |
8.4.0-alpha4 | 21,810 | 3/28/2023 |
8.4.0-alpha3 | 377 | 3/15/2023 |
8.4.0-alpha2 | 637 | 3/1/2023 |
8.4.0-alpha1 | 577 | 2/20/2023 |