Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-59846

Structured Logging in Mongo Shell Generates Invalid JSON

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Logging, Shell
    • None
    • Security 2021-10-04

      The Mongo Shell (not mongosh) produces structured log entries using --verbose that contain invalid JSON:

      {
          "t": {
              "$date": "2021-09-09T09:46:35.891Z"
          },
          "s": "D1",
          "c": "-",
          "id": 23074,
          "ctx": "main",
          "msg": "User assertion",
          "attr": {
              "error": "DNSHostNotFound: Failed to look up service "xxxx-0.xxx.mongodb.net": Success",
              "file": "src/mongo/util/dns_query_posix-impl.h",
              "line": 324
          }
      }
      

      Note that the error is in the attr.error field where the quotes around the hostname are not escaped. The issue appears to be here.

            Assignee:
            gabriel.marks@mongodb.com Gabriel Marks
            Reporter:
            peter.garafano@mongodb.com Peter Garafano (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: