Logging: attr.error field type conflicts

Hey!

We are using fluent-bit to push MongoDB logs to Elasticsearch. But elastic accepts not all logs:

“error”:{“type”:“mapper_parsing_exception”,“reason”:“object mapping for [attr.error] tried to parse field [error] as object, but found a concrete value”}.

There is log with string attr.error:

{“t”:{“$date”:“2022-05-13T15:16:31.203+00:00”},“s”:“I”, “c”:“CONNPOOL”, “id”:22572, “ctx”:“MirrorMaestro”,“msg”:“Dropping all pooled connections”,“attr”:{“hostAndPort”:“mongodb-1.mongodb-headless.mongodb.svc.cluster.local:27017”,“error”:“ShutdownInProgress: Pool for mongodb-1.mongodb-headless.mongodb.svc.cluster.local:27017 has expired.”}}
There is log with object attr.error:

{“t”:{“$date”:“2022-05-13T15:20:56.857+00:00”},“s”:“I”, “c”:“REPL_HB”, “id”:23974, “ctx”:“ReplCoord-680”,“msg”:“Heartbeat failed after max retries”,“attr”:{“target”:“alerta-mongodb-arbiter-0.alerta-mongodb-arbiter-headless.monitoring. svc.cluster.local:27017”,“maxHeartbeatRetries”:2,“error”:{“code”:93,“codeName”:“InvalidReplicaSetConfig”,“errmsg”:“replica set IDs do not match, ours: 61ea35f29cfd494fef169571; remote node’s: 61eef8589d065c56e61d6e52”}}}

bitnami/mongodb:4.4.12-debian-10-r18 docker image is used

Could you direct CONNPOOL error message to attr.error.errmsg instead of attr.error (the same as REPL_HB error message)?

In addition to attr.error, the attr.command.update and attr.from fields also conflict