log4js-elasticsearch
log4js-elasticsearch copied to clipboard
logstash mapping layout no longer supported in new version of elasticsearch
I am getting the following error while trying to write the logs to elasticsearch using logstash layout. I reckon the issue is related to the log4js-elasticsearch-layouts.js file since the mapping being used seems no longer supported in the latest version of elasticsearch. However, even when I tried to remove the part "path": "full" from the file, I am still getting the error in elasticsearch
"mappings" : {
"_default_" : {
"_all" : {"enabled" : enableAll},
"properties" : {
"@fields" : { "type" : "object", "dynamic": true, "path": "full"},
"@message": { "type": "string", "index": "analyzed" },
"@source": { "type": "string", "index": "not_analyzed" },
"@source_host": { "type": "string", "index": "not_analyzed" },
"@source_path": { "type": "string", "index": "not_analyzed" },
"@tags": { "type": "string", "index": "not_analyzed" },
"@timestamp": { "type": "date", "index": "not_analyzed" },
"@type": { "type": "string", "index": "not_analyzed" }
}
}
}
[2016-04-11 16:30:38,712][DEBUG][action.admin.indices.create] [Armory] [logstash-2016.04.11] failed to create
MapperParsingException[Failed to parse mapping [_default_]: Mapping definition for [@fields] has unsupported parameters: [path : full]]; nested: MapperParsingException[Mapping definition for [@fields] has unsupported parameters: [path : full]];
with some fields updated in 5.1, old mappings are not working properly. updated the template to the following working fine
{
"template": "logstash-",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" }
}
},
"mappings": {
"default": {
"_all": { "enabled": false },
"dynamic_templates": [
{
"string_template" : {
"match" : "",
"mapping": { "type": "string", "index": "not_analyzed" },
"match_mapping_type" : "string"
}
}
],
"properties" : {
"@fields": { "type": "object", "dynamic": true },
"@message" : { "type" : "string", "index" : "analyzed" },
"@source" : { "type" : "string", "index" : "not_analyzed" },
"@source_host" : { "type" : "string", "index" : "not_analyzed" },
"@source_path" : { "type" : "string", "index" : "not_analyzed" },
"@tags": { "type": "string", "index" : "not_analyzed" },
"@timestamp" : { "type" : "date", "index" : "not_analyzed" },
"@type" : { "type" : "string", "index" : "not_analyzed" },
"ipAddress" : {"type" : "ip", "index" : "analyzed"}
}
}
}
}
The library is not working with Elastic Search 5.x
TypeError: Cannot read property 'messagePassThroughLayout' of undefined at Object.<anonymous> (c:\dev\temp\test_log4js_es\node_modules\log4js-elasticsearch\lib\log4js-elasticsearch-layouts.js:8:39)
@hmalphettes - can you please fix the the library to support the latest versions of ES?
@hmalphettes I am also facing the same issue. Can you please help in what needs to be done?