Hello,
Using filebeat 6.6
I have a "error" field used in my template, it has to come from the log file.
so, in the configuration file, I disabled the error key with the following parameter:
json.add_error_key: false
But I continue to see a parsing error in the message processed:
2019-03-15T20:01:25.362Z WARN elasticsearch/client.go:523 Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Time{wall:0xbf1b1f04fa851850, ext:10376128117, loc:(*time.Location)(0x21bf500)}, Meta:common.MapStr(nil), Fields:common.MapStr{"source":"/var/log/app-traces/trace-sfused-2019-03-15_20h00-31737.log", "start_time":1.552680080228593e+12, "beat":common.MapStr{"name":"s3-ssl-conn-0.localdomain", "hostname":"s3-ssl-conn-0.localdomain", "version":"6.6.2"}, "offset":760102, "num":"10206284213025646938", "error":common.MapStr{"type":"json", "message":"@timestamp not overwritten (parse error on 2019-03-15T20:01:20.228593+0000)"}, "pid":31737, "_host":"s3-ssl-conn-0.localdomain", "document_type":"doc", "trace_type":"ann_int", "instance":"unconfigured", "service":"sfused", "host":common.MapStr{"name":"s3-ssl-conn-0.localdomain"}, "span_id":3683721572698185, "trace_id":3452903457391402, "parent_span_id":905145127718955, "label":"ino", "log":common.MapStr{"file":common.MapStr{"path":"/var/log/app-traces/trace-sfused-2019-03-15_20h00-31737.log"}}}, Private:file.State{Id:"", Finished:false, Fileinfo:(*os.fileStat)(0xc420322750), Source:"/var/log/app-traces/trace-sfused-2019-03-15_20h00-31737.log", Offset:760428, Timestamp:time.Time{wall:0xbf1b1f04e6068db1, ext:10032290801, loc:(*time.Location)(0x21bf500)}, TTL:-1, Type:"log", Meta:map[string]string(nil), FileStateOS:file.StateOS{Inode:0x1461cba, Device:0xfd01}}}, Flags:0x1} (status=400): {"type":"mapper_parsing_exception","reason":"failed to parse field [error] of type [boolean]","caused_by":{"type":"i_o_exception","reason":"Current token (START_OBJECT) not of boolean type\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@17ab7e25; line: 1, column: 569]"}}
Did I misunderstood the parameter?
here is my actual configuration:
filebeat.yml
filebeat.prospectors:
- fields.document_type: doc
fields_under_root: true
json.keys_under_root: true
json.overwrite_keys: true
json.add_error_key: false
input_type: log
paths:
- /var/log/app-traces/trace-*.log
processors:
- rename:
fields:
- from: host
to: _host
output.elasticsearch:
hosts:
- 10.200.3.221
- 10.200.3.220
- 10.200.3.187
- 10.200.1.76
- 10.200.1.251
- 10.200.1.89
index: app-traces-%{+yyyy.MM.dd}
setup.template.enabled: true
setup.template.json.enabled: true
setup.template.json.name: app-traces
setup.template.json.path: /usr/share/app-tracer-tools/traces_mapping_template.json
setup.template.name: app-traces
setup.template.pattern: app-traces*
setup.template.fields: /etc/filebeat/fields.yml
processors:
- rename:
fields:
- from: _host
to: host
template used:
{
"mappings": {
"doc": {
"properties": {
"layer": {
"type": "keyword"
},
"ip_addr": {
"type": "ip"
},
"string": {
"type": "text"
},
"service": {
"type": "keyword"
},
"@timestamp": {
"type": "date"
},
"parent_span_id": {
"index": "false",
"type": "long"
},
"trace_type": {
"type": "keyword"
},
"trace_id": {
"type": "long"
},
"label": {
"type": "keyword"
},
"ip_port": {
"type": "long"
},
"instance": {
"type": "keyword"
},
"host": {
"type": "keyword"
},
"num": {
"type": "keyword"
},
"end_time": {
"type": "double"
},
"key": {
"type": "keyword"
},
"error": {
"type": "boolean"
},
"cancelled": {
"type": "boolean"
},
"path": {
"type": "text"
},
"span_id": {
"index": "false",
"type": "long"
},
"start_time": {
"type": "double"
},
"op": {
"type": "keyword"
}
}
}
},
"template": "scality-traces-*",
"settings": {
"index.refresh_interval": "30s"
}
}