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

Structured Logging in Mongo Shell Generates Invalid JSON

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Cannot Reproduce
    • None
    • None
    • Logging, Shell
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: