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

Structured Logging in Mongo Shell Generates Invalid JSON

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            gabriel.marks Gabriel Marks
            Reporter:
            peter.garafano Peter Garafano
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: