serilog-sinks-elasticsearch
serilog-sinks-elasticsearch copied to clipboard
period (.) in scope keys getting converted to /
I'm using a Scope of Dictionary<string, object> and I have keys like Foo.Bar and that's getting converted to Foo/Bar in elastic search. How can I fix this.
If you change these to no-ops then dots work fine in elastic search. Seems elastic search has allowed dots since somewhere around the 5.x version. Please allow for config option to allow dots.
https://github.com/serilog/serilog-sinks-elasticsearch/blob/67175c8f5d3c3d0783bb5c5996833cf1eea2597d/src/Serilog.Formatting.Elasticsearch/ElasticsearchJsonFormatter.cs#L133-L150
Interesting indeed, ES allowed dots again. Care for a PR?
Old issue, cleaning up. Still facing this issue, feel free to reopen.
Looks like the conversation went stale in 2019 but just stating that this issue is still present in latest serilog version (2.9.0. at time of writing). @mivano, I am not too familiar with the codebase of serilog, but if you give some hint about how to check specific ES version, given that this is allowed since 5.x, I am willing to fix this and create a PR.
In the v8 of the sink there is a way to detect the version: https://github.com/serilog/serilog-sinks-elasticsearch/blob/dev/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs#L245 Maybe that can be used to query for a specific version and determine what to do?