Hello, this my second time posting here with a hope to find a solution this time. I'm working on the Elastic Stack. I'm sending logs from Filebeat through Logstash to Elasticsearch. My logs get structured in Logstash, nonetheless I get an error message that's annoying me. I have created several pipelines and I am using the distributor pattern with a main pipeline that dispatches the logs according their types into respective pipelines where they get structured. I have indices and mappings for each log type, and those mappings explicitly define the type of each field so there is noway I have fields that are defined as 2 different types. In logstash-plain.log I get the following warn logs:
[2021-09-22T12:24:14,229][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"1750442601", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"i06-m-cx/dt/xpad_s540", "domain"=>"i06-m-cx", "family"=>"dt", "member"=>"xpad_s540"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2864708464", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"INFO", "ndc"=>{}, "@timestamp"=>2021-03-26T08:16:23.620Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210326-14h46/i06-m-cx_dt_xpad_s540.log"}, "offset"=>16731, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"-------------------------------------------------------"}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"1750442601", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '1750442601'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:498"}}}}}
[2021-09-22T12:24:14,231][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"2908326686", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"i06-m-cx/dt/xpad_s540", "domain"=>"i06-m-cx", "family"=>"dt", "member"=>"xpad_s540"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2902440816", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"INFO", "ndc"=>{}, "@timestamp"=>2021-03-26T08:16:23.620Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210326-14h46/i06-m-cx_dt_xpad_s540.log"}, "offset"=>16991, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"-> yat::DEVICE_SNAP_MSG"}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"2908326686", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '2908326686'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:498"}}}}}
[2021-09-22T12:24:14,233][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"4080914791", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"flyscan/core/server.1", "domain"=>"flyscan", "family"=>"core", "member"=>"server.1"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2956016496", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"INFO", "ndc"=>{}, "@timestamp"=>2021-01-26T14:24:10.376Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210327-06h46/flyscan_core_server.1.log.1"}, "offset"=>8495, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"Check monitor tango_recorder_monitor(DeviceStateMonitor)"}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"4080914791", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '4080914791'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:498"}}}}}
[2021-09-22T12:24:14,235][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"4247124957", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"i06-m-c00/ex/scan.1", "domain"=>"i06-m-c00", "family"=>"ex", "member"=>"scan.1"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2959076208", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"INFO", "ndc"=>{}, "@timestamp"=>2021-03-24T22:49:23.298Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210326-14h46/i06-m-c00_ex_scan.1.log.1"}, "offset"=>3666, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"Waiting for timebases to complete integration..."}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"4247124957", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '4247124957'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:494"}}}}}
[2021-09-22T12:24:14,237][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"1869467806", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"i06-m-c00/ex/scan.1", "domain"=>"i06-m-c00", "family"=>"ex", "member"=>"scan.1"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2959076208", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"INFO", "ndc"=>{}, "@timestamp"=>2021-03-24T22:49:24.549Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210326-14h46/i06-m-c00_ex_scan.1.log.1"}, "offset"=>3917, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"Executing sensors after-integration hooks..."}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"1869467806", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '1869467806'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:494"}}}}}
[2021-09-22T12:24:14,239][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"235356131", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"flyscan/core/recorder-proxy.1", "domain"=>"flyscan", "family"=>"core", "member"=>"recorder-proxy.1"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2952784752", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"ERROR", "ndc"=>{}, "@timestamp"=>2021-02-02T14:58:52.367Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210327-14h46/flyscan_core_recorder-proxy.1.log"}, "offset"=>1784, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"[Ex:1-Err:1] Rsn: API_AttributeFailed Dsc: Failed to read_attribute on device flyscan/core/tango-recorder.1, attribute state Org: DeviceProxy::read_attribute()"}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"235356131", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '235356131'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:515"}}}}}
[2021-09-22T12:24:14,241][WARN ][logstash.outputs.elasticsearch][cppdevices][ddfca0e0830cc67ad422a07327a2b66558e87a53962e37ee60acb52071b7c8d0] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>"964794382", :_index=>"cppdevices", :routing=>nil}, {"event"=>{}, "device"=>{"name"=>"flyscan/core/recorder-proxy.1", "domain"=>"flyscan", "family"=>"core", "member"=>"recorder-proxy.1"}, "agent"=>{"name"=>"localhost.localdomain", "ephemeral_id"=>"79dc4716-1561-4593-97a7-a925fa474785", "version"=>"7.14.0", "type"=>"filebeat", "hostname"=>"localhost.localdomain", "id"=>"5f61175d-e407-49d3-b9a3-3efa77d25554"}, "@version"=>"1", "input"=>{"type"=>"log"}, "thread"=>"2952784752", "host"=>{"name"=>"localhost.localdomain"}, "tags"=>["cppdevices", "beats_input_codec_plain_applied"], "level"=>"ERROR", "ndc"=>{}, "@timestamp"=>2021-02-02T14:58:52.868Z, "log"=>{"file"=>{"path"=>"/vagrant/assembly/ds_RecordingManager/cppdevices/cpplogs-20210327-14h46/flyscan_core_recorder-proxy.1.log"}, "offset"=>2157, "flags"=>["multiline"]}, "ecs"=>{"version"=>"1.10.0"}, "message"=>"[Ex:2-Err:0] Rsn: API_CantConnectToDevice Dsc: Failed to connect to device flyscan/core/tango-recorder.1\nThe connection request was delayed.\nThe last connection request was done less than 1000 ms ago Org: Connection::reconnect"}], :response=>{"index"=>{"_index"=>"cppdevices", "_type"=>"_doc", "_id"=>"964794382", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [ndc] of type [keyword] in document with id '964794382'. Preview of field's value: '{}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:515"}}}}}
I looked everywhere for a solution, but no one seems to give a clear and helpful workaround for this issue. People led me to read articles that did not quite explain how to get rid of this. I appreciate you giving a solution if you have one and not a link to an article, because I have read already without success.
Thanks in advance,
Jamal