[SERVER-50432] In at least one instance (4615603), log index keys as strings instead of deflated JSON Created: 20/Aug/20 Updated: 29/Oct/23 Resolved: 25/Sep/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Logging |
| Affects Version/s: | 4.4.0 |
| Fix Version/s: | 4.8.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Eric Sedor | Assignee: | Eric Cox (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | qexec-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Query 2020-10-05 | ||||||||
| Participants: | |||||||||
| Description |
|
Downstream consumers of structured logs could have problems persisting/rendering log line 4615603, and potentially others. The convention of logging index keys as Extended JSON with deflated key names (e.g., { "": "valueA", "": "valueB" } in index {a:1, b:1}) will probably lead many consumers to receive a single-field document with only the last value (e.g., { "": "valueB" }) unless they introduce special handling. To be clear, we do log the index key correctly. It is just in a convention that many clients will readily mangle. At a minimum, can log line 4615603 log attr.indexKeyData.key as a string instead of Extended JSON? There may be a more generic solution that fixes all log lines impacted, but it is yet unclear how many log lines are impacted. |
| Comments |
| Comment by Githook User [ 25/Sep/20 ] | ||||
|
Author: {'name': 'Eric Cox', 'email': 'eric.cox@mongodb.com', 'username': 'ericox'}Message: | ||||
| Comment by Bruce Lucas (Inactive) [ 21/Aug/20 ] | ||||
|
The JSON spec says that field names "SHOULD" be unique, meaning that it's recommended because of undesirable consequences, but not mandatory. As Eric indicates many tools that log consumers will want to used to process logs will not handle duplicate key names; for example jq:
So it would be good where possible to avoid emitting log lines with duplicate keys. |