Comments (5)
Forgot to add, I have the following packages installed for the test console app.
<packages>
<package id="Elasticsearch.Net" version="2.4.6" targetFramework="net461" />
<package id="Serilog" version="2.3.0" targetFramework="net461" />
<package id="Serilog.Sinks.Elasticsearch" version="4.1.1" targetFramework="net461" />
<package id="Serilog.Sinks.File" version="3.1.1" targetFramework="net461" />
<package id="Serilog.Sinks.PeriodicBatching" version="2.1.0" targetFramework="net461" />
<package id="Serilog.Sinks.RollingFile" version="3.2.0" targetFramework="net461" />
</packages>
from serilog-sinks-elasticsearch.
I have been toying with Elasticsearch API (via Sense) and if I run the following request without registering any templates, I get the entry created.
POST _bulk
{"index":{"_index":"logstash-2016.11.17","_type":"logevent"}}
{"@timestamp":"2016-11-17T14:23:57.9886572+00:00","level":"Information","messageTemplate":"Here is some stuff {@0}","message":"Here is some stuff { NowIs: 11/17/2016 14:23:57, SomeStuff: \"something\" }","fields":{"0":{"NowIs":"2016-11-17T14:23:57.9561564Z","SomeStuff":"something"}}}
{
"took": 16,
"errors": false,
"items": [
{
"index": {
"_index": "logstash-2016.11.17",
"_type": "logevent",
"_id": "AVhy0hLmTiBab5jV7DWH",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"created": true,
"status": 201
}
}
]
}
If I run the sink's template, the same _bulk query results in error:
{
"took": 331,
"errors": true,
"items": [
{
"index": {
"_index": "logstash-2016.11.17",
"_type": "logevent",
"_id": "AVhy3diRTiBab5jV7DWQ",
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse [fields.0]",
"caused_by": {
"type": "illegal_state_exception",
"reason": "Can't get text on a START_OBJECT at 1:219"
}
}
}
}
]
}
The created template is :
{
"serilog-events-template": {
"order": 0,
"template": "logstash-*",
"settings": {
"index": {
"refresh_interval": "5s"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"numerics_in_fields": {
"match_pattern": "regex",
"path_match": "fields\\.[\\d+]$",
"mapping": {
"index": "analyzed",
"omit_norms": true,
"type": "string"
}
}
},
{
"string_fields": {
"mapping": {
"index": "analyzed",
"omit_norms": true,
"type": "string",
"fields": {
"raw": {
"ignore_above": 256,
"index": "not_analyzed",
"type": "string"
}
}
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"_all": {
"omit_norms": true,
"enabled": true
},
"properties": {
"message": {
"index": "analyzed",
"type": "string"
},
"exceptions": {
"type": "nested",
"properties": {
"ExceptionMessage": {
"type": "object",
"properties": {
"MemberType": {
"type": "integer"
}
}
},
"StackTraceString": {
"index": "analyzed",
"type": "string"
},
"HResult": {
"type": "integer"
},
"RemoteStackTraceString": {
"index": "analyzed",
"type": "string"
},
"RemoteStackIndex": {
"type": "integer"
},
"Depth": {
"type": "integer"
}
}
}
}
}
},
"aliases": {}
}
}
from serilog-sinks-elasticsearch.
I think this repository might be dead, which is unfortunate. We should maybe fork it and create our own.
from serilog-sinks-elasticsearch.
The default template mapping tries to force the default 0, 1, etc fields to be strings in order to support old applications where you log for example:
Log.Information("log line 1", 29292);
Log.Information("log line 2", "text");
Without the mapping, the fields.0 will become a integer field (as that is the first event that gets consumed) and then ES will fail to parse the string. So we force the 0,1,2, etc to be a string. You try however to fit an object in there which cannot be parsed.
So indeed use another name, add a destructor for these types or change the default template.
from serilog-sinks-elasticsearch.
The ES mapper warnings are fixed in v5.7
from serilog-sinks-elasticsearch.
Related Issues (20)
- v9.0.0 fails template creation with ES v7 with ElasticsearchClientException HOT 3
- v. 9.0.0 - ElasticsearchClientException: Could not authenticate with the specified node HOT 1
- Add autogenerated template IndexAliases configuration properties HOT 2
- Possible clock issue?
- The ES7 template registration throw an exception HOT 1
- New version 9.0.3 doesn't work with Logstash HOT 1
- The client noticed that the server is not a supported distribution of Elasticsearch. HOT 1
- 9.0.3 did not bring in changes from 9.0.2 HOT 2
- Unable to connect and write logs to Elasticsearch v8.8.1 HOT 3
- Unable to upload logs to Elastic Search Cloud HOT 1
- Unable to send logs to OpenTelemetry backend (using Serilog in .Net framework 4.8)
- How can i add a custom Id to es with Serilog.Sinks.Elasticsearch
- Support the new TraceId and SpanId in Serilog HOT 1
- Add Support for OpenSearch.
- How do I update Dotnet Serilog Logging Config to Deal with new Elastic 8 security (https, username, password, tls cert)? HOT 1
- Enable configuration of IndexDecider also from a config file
- serilog.sinks.elasticsearch is missing NuGet package README file
- Not Load Type
- Serilog.Sinks.Elasticsearch 10.0.0 don't works with Serilog.Sinks.MariaDB 1.0.1
- Future of this sink HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serilog-sinks-elasticsearch.