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

Make log files more machine-parsable

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.2
    • Affects Version/s: None
    • Component/s: Logging
    • Labels:
    • Minor Change

      Currently it is hard to automatically parse mongod and mongos logfiles due to little inconsistencies and ambiguities that can easily be fixed.


      Wed Sep 05 18:17:35 [conn106842] getmore test.docs query: { ps: 3 } cursorid:77621193264928 ntoreturn:0 keyUpdates:0 numYields: 7 locks(micros) r:12009 nreturned:1044 reslen:2628447 15ms

      Most counters like ntoreturn:1, nreturned:1, ... have no space after the colon, but numYields: 1 does have a space after the colon, making its value a separate token when splitting the line on spaces. Please remove the space after numYields:.

      Space before "ms"

      Most timed operations print their duration as ###ms (#=digit). Some, however, have a space before the ms.

      Wed Sep 05 18:56:05 [DataFileSync] FlushViewOfFile for F:/data/local.3 failed with error 1 after 1 attempts taking 933 ms

      Please remove the space. As this is a counter like the ones above, it would also make sense to replace this with duration:### instead for consistency.

      read/write lock syntax

      The read and write lock microsecond numbers currently have this syntax:

      Wed Jun 19 13:48:13.454 [conn2] insert test.docs ninserted:1 keyUpdates:0 locks(micros) w:231001 230ms

      The w: is ambiguous with for example the getlasterror command with write concern. The actual indicator locks(micros) is a separate and not very useful token.

      Suggestion: remove the locks(micros) and rename the actual w: and r: labels to wlock: and rlock:.

      Server Restarted

      ***** SERVER RESTARTED *****

      Instead of the two empty lines before and after the server restarted messages, it should be in one single line, with a date and time like all the other lines.

      These are trivial changes but would be very useful for machine parsing.

            Unassigned Unassigned
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            0 Vote for this issue
            6 Start watching this issue