Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-29458

Using tabulations in logs seems to break JSON logging

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.10
    • Fix Version/s: HOTFIX_10.10, 11.x
    • Component/s: Infrastructure

      Description

      When enabling JSON logging, some logs are not well forwarded and analyzed in tools like Datadog.

      For instance in https://github.com/nuxeo/nuxeo/blob/2387c0ba417810c3b68fd8d51795b46cdee6f579/modules/core/nuxeo-core-storage-sql/nuxeo-core-storage-sql/src/main/java/org/nuxeo/ecm/core/storage/sql/SessionImpl.java#L1177

      we end up with the following message:

      {
        "id": "AQAAAXORYTaR-jvaxAAAAABBWE9SWVRkM0tzZWh6VG4zZVlBQQ",
        "content": {
          "timestamp": "2020-07-27T17:45:34.097Z",
          "tags": [
      
            "service:nuxeo",
            "source:nuxeo",
      
          ],
          "host": "fifthsun-prod-nuxp-230-10-4-7-151-usw",
          "service": "fifthsun-230",
          "message": "2020-07-27 17:45:33,411 INFO  [http-nio-0.0.0.0-8080-exec-38][org.nuxeo.ecm.core.storage.sql.SessionImpl] duration_ms:\t1014.70\tQueryFilter(principal=lmatz, limit=149999, offset=0) count total results up to 200\tquery\tSELECT * FROM Domain WHERE ecm:mixinType != 'HiddenInNavigation' AND ecm:currentLifeCycleState != 'deleted' ORDER BY dc:title{{RemoteAddr,127.0.0.1}{RequestURL,http://fifthsun.nuxeocloud.com/nuxeo/view_documents.faces}{ServletPath,/view_documents.faces}{SessionID,F8F4E40BF22330CA000C0F8A271B0205.nuxeo}{UserPrincipal,lmatz}{tx,2cffffffe8560000047544d4944}}",
          "attributes": {}
        }
      }
      
      

      whereas a normal message received by Datadog should look like:

      {
        "id": "xxxxx",
        "content": {
          "timestamp": "2020-07-27T17:46:27.731Z",
          "tags": [
            "service:nuxeo",
            "source:nuxeo",
          ],
          "host": "xxxxxxxxxxxxxx",
          "service": "xxxxxx",
          "message": "Asset has changed",
          "attributes": {
            "class": "org.nuxeo.somepackage.SomeClass",
            "@timestamp": "2020-07-27T17:46:27.731Z",
            "source_host": "xxxx",
            "file": "Bla.java",
            "method": "handleEvent",
            "level": "WARN",
            "line_number": "42",
            "thread_name": "http-nio-0.0.0.0-8080-exec-33",
            "@version": 1,
            "logger_name": "org.nuxeo....",
            "mdc": {
              "tx": "5663430000047544d4944",
              "ServletPath": "/view_documents.faces",
              "SessionID": "3A9C51B2E52616F7DBDFB78473285E5E.nuxeo",
              "RemoteAddr": "127.0.0.1"
            }
          }
        }
      }
      

      This prevent analyzing those logs in production.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dmetzler Damien Metzler
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: