[SERVER-16618] Log file should print extended json compliant syntax Created: 20/Dec/14  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Logging, Usability
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 4
Labels: move-sec, platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-16620 escape double quotes \" when printing... Closed
is related to SERVER-6813 Shell support for Extended JSON Closed
is related to SERVER-13209 Ensure extended shell JSON ouput form... Closed
Assigned Teams:
Server Security
Participants:
Case:

 Description   

We have extended json syntax for most types, see http://docs.mongodb.org/manual/reference/mongodb-extended-json/

There are two flavors: "strict" and "shell" mode.

Yet when certain types are printed in the log file, they don't comply to either of these formats, instead using arbitrary syntax that is hard to parse and cannot be simply copy&pasted back into the shell.

All types should be printed as strict or shell syntax in the log for consistency. Preferably shell syntax since mongo shell can't yet understand strict syntax (see related ticket, SERVER-6813).

Examples:

Timestamp

shell

> Timestamp(1, 0)
Timestamp(1, 0)

log file

Timestamp 0|0

NumberLong

shell

> NumberLong("9223372036854775807")
NumberLong("9223372036854775807")

log file (would be misinterpreted as floating point value)

9223372036854775807

BinData

shell

> BinData(3, "0123456789ABCDEFFEDCBA9876543210")
BinData(3,"0123456789ABCDEFFEDCBA9876543210")

log file (quotes missing)

BinData(3,0123456789ABCDEFFEDCBA9876543210)

And so on.


Generated at Thu Feb 08 03:41:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.