-
Notifications
You must be signed in to change notification settings - Fork 196
Make Serilog.Sinks.Elasticsearch
version 9.0.0 work with Elasticsearch version <7, 7 and 8 by default, without need to specify TypeName
#460
Comments
I tried this approach with my fork. This particular commit. It works for my use-case (tested against Elasticsearch |
@nenadvicentic Had the same idea to start implementing this, but you beat me to it by a few minutes 😆 Can we start a PR here with your changes and get it reviewed? Another thing is that we need an auto registered template that works for Elasticsearch v8. |
@jonasmidstrup Yes, I can make PR out of this. However, I think I would need someone who has a bit more context and historical knowledge of the project. For example, I'm not sure what kind of auto registered template is needed. It seems that v7 template works fine against Elasticsearch v8. Also |
We should take the discussion in the PR 😃 and maybe involve @mivano for context and historical knowledge. When I try to use the auto-registered template, it shows up in Kibana under "Index Management" as a "Legacy index template". So I would guess that something needs to be done here as well. |
@jonasmidstrup I agree! There is the PR request #462 |
I m too far out on ES and the specifics for the needed options. I do know indeed that the current way is not optimal. We also strived for zero config (so pointing to ES cluster should have been enough to start logging). Discovering version and applying default settings should help with that. Elastic is moving forward with new versions and it would be strange not to keep up the pace with this sink as well. If you have a nice PR, are able to test and validate it, then I m more than happy to get it in! Breaking changes are okay, as long as we document and version. |
@mivano PR is there #462 , and it's already capable to automatically handle different versions, but it requires option: It does seem like good idea to have version-discovery + I can make some of those improvements, but there are two areas where I would need help.
Maybe take a look at the PR and we can discuss how to extend/finalize it. |
Any progress on this? |
Unfortunately, nothing conclusive. I have tried to finish this feature, but insistence to add Elasticsearch v8 template in the same pull request also lead to a 2nd issue, that there is a new endpoint of v8 templates. That means, as far as I can see, that Shortly, I would like to finish this, but without anyone who knows |
@nenadvicentic thanks for your efforts. Regarding the what and why's of this project; I m afraid I can't help that much either anymore. See #486 for background. That also means that the how can be open to a lot of options as well. The main intent of this sink was always to get started with a minimum of parameters (only location of ES) and everything would be handled. During the years (since 2014), a lot has changed, not only in the amount of options, but also the different ES versions and .NET versions. Without understanding the full extent of this specific issue, there are a couple of ways forward; like dropping support for netframework, for 3.1 etc. Same for no longer sticking with ES smaller than e.g. 7. Unfortunately we do not know what people are using and needing, on the other hand; this is an open source project, not a long term support project. It makes life a lot easier if we can skim down on a couple of features, bring it to a newer framework and continue from there. If there is still a need for e.g. ES 6, then just stick with a specific version of this sink, or make a fork. So if you (and/or anybody else) have the time, energy and interest, then please take the opportunity to bring this sink to a new level, even if that means we need to make concessions. |
@mivano Thank you for context and additional explanation. It helps to wrap my head around some of the issues I faced. I will put additional into this feature and try to finish it best I can, if it is OK for everyone here. Company I work for agreed to give me time to do this. Regarding maintenance of this project, at this point it would not fit with my schedules. Also, my Elasticsearch knowledge is on "occasional consumer" level. |
@mivano I agree with your consensus, it's better to skim down on a couple of features and try to get this project running with the newer frameworks. The current project works well with the previous versions, so people can stay on those versions if they so wish. @nenadvicentic Thank you for taking the time to try and finish this feature. I'm sure it will be very appreciated by everyone using this project . |
#462 has been merged to |
This is a suggestion for a new feature in version 9. Simplification of the way
Serilog.Sinks.Elasticserach
handles different version ofElasticsearch
backend.If
TypeName
parameter has not been explicitly specified in code or config, handle_type
parameter sent to a different versions ofElasticsearch
automatically! That means:_type: "logevent"
for <v7,_type: "_doc"
for v7for v8 (or higher)._type
We could do this by:
ElasticsearchSinkOptions.TypeName
during the Sink initialization in the constructors (so the value keep being null).DiscoverClusterVersion
method like shown bellow. Method could be triggered by exposing"detectElasticsearchVersion": true
configuration option, since currentlyDetectElasticsearchVersion
is not used at all (DiscoverClusterVersion()
method never goes through). Alternatively, more intuitive option name could be used, likeautomaticallyResolveTypeName
.Perhaps
ElasticsearchSinkOptions.DefaultTypeName
should be reverted back to"logevent"
, from "_doc" and used, as described in the summary: "The default Elasticsearch type name used for Elasticsearch versions prior to 7."The text was updated successfully, but these errors were encountered: