Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Commit 3d1dce0

Browse files
nenadvicenticNenad Vicentic
and
Nenad Vicentic
authored
Remove support for Elasticsearch v2 and v5. (#488)
* Remove support for Elasticsearch v2 and v5. * Code-conventions: add rule for underscore `_` on private fields (as it already is in the code). * Remove GitHub's `set-output` command deprication warning. Co-authored-by: Nenad Vicentic <[email protected]>
1 parent 5b9795f commit 3d1dce0

File tree

10 files changed

+26
-153
lines changed

10 files changed

+26
-153
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,19 @@ indent_size = 4
66

77
[*.csproj]
88
indent_size = 2
9+
10+
# Code files
11+
[*.{cs,csx,vb,vbx}]
12+
###############################
13+
# Naming Conventions #
14+
###############################
15+
# Underscore for private fields
16+
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
17+
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
18+
dotnet_naming_rule.private_members_with_underscore.severity = suggestion
19+
20+
dotnet_naming_symbols.private_fields.applicable_kinds = field
21+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
22+
23+
dotnet_naming_style.prefix_underscore.capitalization = camel_case
24+
dotnet_naming_style.prefix_underscore.required_prefix = _

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Added
1212
- PR #462
13+
- PR #488
1314

1415
### Major Changes
1516
- `DetectElasticsearchVersion` is set to `true` by default.
1617
- When `DetectElasticsearchVersion` is set to `false` Elasticsearch version 7 is assumed (as it has broadest wire-compatibility at the moment - v7 and v8)
1718
- When `DetectElasticsearchVersion` is set to `true`, `TypeName` is handled automatically across different versions of Elasticserach (6.x to 8.x). For example, user-defined name will NOT be used on v7 and v8. Also, correct templates endpoint will be picked up.
1819
- Elasticsearch 8.x endpoint for templates is supported (`_index_template`)
1920
- Internal class `ElasticsearchVersionManager` has been added, mainly to handle situations where detection of version fails or when it is disabled. In the case of fallback, sink will assume "default" version 7.
20-
- Elasticsearch.NET client version 7.15.2 (latest version 7, until new `Elastic.Clients.Elasticsearch` 8.x catches up functional parity with 7.x)
21+
- Elasticsearch.NET client version 7.15.2 (latest version 7, until new `Elastic.Clients.Elasticsearch` 8.x catches up functional parity with 7.x).
22+
- Elasticsearch server versions 2 and 5 are no longer supported.
2123

2224
### Other Changes
2325
- Nuget pacakges have been updated (except for the Elasticsearch integration-tests related packages)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The Serilog Elasticsearch sink project is a sink (basically a writer) for the Se
3030
* Starting from version 3, compatible with Elasticsearch 2.
3131
* Version 6.x supports the new Elasticsearch.net version 6.x library.
3232
* From version 8.x there is support for Elasticsearch.net version 7.
33-
* From version 9.x there is support for Elasticsearch.net version 8. Version detection is enabled by default, in which case `TypeName` is handled automatically across major versions 6, 7 and 8.
33+
* From version 9.x there is support for Elasticsearch.net version 8. Version detection is enabled by default, in which case `TypeName` is handled automatically across major versions 6, 7 and 8. Versions 2 and 5 of Elasticsearch are no longer supported.
3434

3535

3636
## Quick start

src/Serilog.Sinks.Elasticsearch/LoggerConfigurationElasticSearchExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static LoggerConfiguration Elasticsearch(
102102
{
103103
return Elasticsearch(loggerSinkConfiguration, nodeUris, indexFormat, templateName, typeName, batchPostingLimit, period, inlineFields, restrictedToMinimumLevel, bufferBaseFilename,
104104
bufferFileSizeLimitBytes, bufferLogShippingInterval, connectionGlobalHeaders, levelSwitch, 5, EmitEventFailureHandling.WriteToSelfLog, 100000, null, false,
105-
AutoRegisterTemplateVersion.ESv2, false, RegisterTemplateRecovery.IndexAnyway, null, null, null);
105+
AutoRegisterTemplateVersion.ESv7, false, RegisterTemplateRecovery.IndexAnyway, null, null, null);
106106
}
107107

108108
/// <summary>

src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchTemplateProvider.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ namespace Serilog.Sinks.Elasticsearch
99
/// </summary>
1010
public enum AutoRegisterTemplateVersion
1111
{
12-
/// <summary>
13-
/// Elasticsearch version &lt;= 2.4
14-
/// </summary>
15-
ESv2 = 0,
16-
/// <summary>
17-
/// Elasticsearch version &lt;= version 5.6
18-
/// </summary>
19-
ESv5 = 1,
2012
/// <summary>
2113
/// Elasticsearch version &gt;= version 6.0
2214
/// </summary>
@@ -40,7 +32,7 @@ public static object GetTemplate(ElasticsearchSinkOptions options,
4032
int discoveredMajorVersion,
4133
Dictionary<string, string> settings,
4234
string templateMatchString,
43-
AutoRegisterTemplateVersion version = AutoRegisterTemplateVersion.ESv2)
35+
AutoRegisterTemplateVersion version = AutoRegisterTemplateVersion.ESv7)
4436
{
4537
switch (version)
4638
{
@@ -50,10 +42,6 @@ public static object GetTemplate(ElasticsearchSinkOptions options,
5042
return GetTemplateESv7(options, discoveredMajorVersion, settings, templateMatchString);
5143
case AutoRegisterTemplateVersion.ESv6:
5244
return GetTemplateESv6(options, discoveredMajorVersion, settings, templateMatchString);
53-
case AutoRegisterTemplateVersion.ESv5:
54-
return GetTemplateESv5(settings, templateMatchString);
55-
case AutoRegisterTemplateVersion.ESv2:
56-
return GetTemplateESv2(settings, templateMatchString);
5745
default:
5846
throw new ArgumentOutOfRangeException(nameof(version), version, null);
5947
}

src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ private object GetTemplateData()
251251
>= 8 => AutoRegisterTemplateVersion.ESv8,
252252
7 => AutoRegisterTemplateVersion.ESv7,
253253
6 => AutoRegisterTemplateVersion.ESv6,
254-
5 => AutoRegisterTemplateVersion.ESv5,
255-
2 => AutoRegisterTemplateVersion.ESv2,
256254
_ => throw new NotSupportedException()
257255
};
258256

test/Serilog.Sinks.Elasticsearch.IntegrationTests/Serilog.Sinks.Elasticsearch.IntegrationTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<PackageReference Include="FluentAssertions" Version="6.9.0" />
3131
<PackageReference Include="NEST" Version="7.17.5" />
3232
<PackageReference Include="coverlet.msbuild" Version="3.2.0" PrivateAssets="all" />
33-
<PackageReference Include="ReportGenerator" Version="5.1.13" />
33+
<PackageReference Include="ReportGenerator" Version="5.1.15" />
3434
</ItemGroup>
3535

3636
<ItemGroup Condition="$(ContinuousIntegrationBuild) == 'true'">
@@ -59,6 +59,6 @@
5959
</Target>
6060

6161
<Target Name="PrintCoverageReportPathForGitHubActions" AfterTargets="GenerateCoverageResultAfterTest" Condition="$(ContinuousIntegrationBuild) == 'true'">
62-
<Message Importance="high" Text="::set-output name=coverage-reports::@(CoverletReport, ',')" />
62+
<Message Importance="high" Text="&quot;coverage-reports=@(CoverletReport, ',')&quot; >> $GITHUB_OUTPUT" />
6363
</Target>
6464
</Project>

test/Serilog.Sinks.Elasticsearch.Tests/Serilog.Sinks.Elasticsearch.Tests.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
</PropertyGroup>
2929

3030
<ItemGroup>
31-
<None Remove="Templating\template_v5.json" />
3231
<None Remove="Templating\template_v6.json" />
3332
<None Remove="Templating\template_v7.json" />
3433
<None Remove="Templating\template_v7_no-aliases.json" />
@@ -49,7 +48,6 @@
4948
<EmbeddedResource Include="Templating\template_v8.json" />
5049
<EmbeddedResource Include="Templating\template_v7.json" />
5150
<EmbeddedResource Include="Templating\template_v6.json" />
52-
<EmbeddedResource Include="Templating\template_v5.json" />
5351
</ItemGroup>
5452

5553
<ItemGroup>
@@ -71,7 +69,7 @@
7169
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
7270
<PackageReference Include="FluentAssertions" Version="6.9.0" />
7371
<PackageReference Include="coverlet.msbuild" Version="3.2.0" PrivateAssets="all" />
74-
<PackageReference Include="ReportGenerator" Version="5.1.13" />
72+
<PackageReference Include="ReportGenerator" Version="5.1.15" />
7573

7674
</ItemGroup>
7775

@@ -105,7 +103,7 @@
105103
</Target>
106104

107105
<Target Name="PrintCoverageReportPathForGitHubActions" AfterTargets="GenerateCoverageResultAfterTest" Condition="$(ContinuousIntegrationBuild) == 'true'">
108-
<Message Importance="high" Text="::set-output name=coverage-reports::@(CoverletReport, ',')" />
106+
<Message Importance="high" Text="&quot;coverage-reports=@(CoverletReport, ',')&quot; >> $GITHUB_OUTPUT" />
109107
</Target>
110108

111109
<ItemGroup>

test/Serilog.Sinks.Elasticsearch.Tests/Templating/Sendsv5TemplateTests.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

test/Serilog.Sinks.Elasticsearch.Tests/Templating/template_v5.json

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)