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

Commit

Permalink
Merge pull request #1 from serilog/dev
Browse files Browse the repository at this point in the history
qewdwqqwd
  • Loading branch information
ffMathy authored May 24, 2017
2 parents 8ce6c6e + fd62138 commit f318f6d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function Invoke-Build()
Remove-Item .\artifacts -Force -Recurse
}


& dotnet restore $test --verbosity Warning
& dotnet restore $project --verbosity Warning

Expand All @@ -22,7 +21,7 @@ function Invoke-Build()
Write-Output "Determining version number using gitversion"

& cd $projectFolder
& dotnet gitversion $project --verbosity Warning
& dotnet gitversion --verbosity Warning
& cd "..\\.."
}
else
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
5.1
* You can specify the number of shards when creating the template mapping. This will only apply to newly created indices.

5.0
* To make the sink work in line with the other sinks, there is a breaking change as described in PR (https://github.com/serilog/serilog-sinks-elasticsearch/pull/94). minimumLogEventLevel is renamed to restrictedToMinimumLevel. The behaviour is now also consistent when you set the minimum level.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ public class ElasticsearchSinkOptions
/// </summary>
public bool OverwriteTemplate { get; set; }

/// <summary>
/// When using the <see cref="AutoRegisterTemplate"/> feature, this allows you to override the default number of shards.
/// If not provided, this will default to the default number_of_shards configured in Elasticsearch.
/// </summary>
public int? NumberOfShards { get; set; }

/// <summary>
/// When using the <see cref="AutoRegisterTemplate"/> feature, this allows you to override the default number of replicas.
/// If not provided, this will default to the default number_of_replicas configured in Elasticsearch.
/// </summary>
public int? NumberOfReplicas { get; set; }

///<summary>
/// Connection configuration to use for connecting to the cluster.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,21 @@ public void RegisterTemplateIfNeeded()
}
else
{
var settings = new Dictionary<string, string>
{
{"index.refresh_interval", "5s"}
};

if (_options.NumberOfShards.HasValue)
settings.Add("number_of_shards", _options.NumberOfShards.Value.ToString());

if (_options.NumberOfReplicas.HasValue)
settings.Add("number_of_replicas", _options.NumberOfReplicas.Value.ToString());

var result = this._client.IndicesPutTemplateForAll<DynamicResponse>(this._templateName, new
{
template = this._templateMatchString,
settings = new Dictionary<string, string>
{
{"index.refresh_interval", "5s"}
},
settings = settings,
mappings = new
{
_default_ = new
Expand Down
2 changes: 1 addition & 1 deletion src/Serilog.Sinks.Elasticsearch/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.1.1",
"version": "5.1.0",
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../assets/Serilog.snk",
Expand Down

0 comments on commit f318f6d

Please sign in to comment.