Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4201

Add support for structured logging



    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Done
    • None
    • PUP 3.8.0, PUP 4.1.0
    • None
    • None
    • 4
    • Language 2015-03-18, Language 2015-04-01
    • New Feature



      The resolution of this ticket was to add structured support to the file based logger such that, if the log file's name ends with .json then the output to it will be in JSON format. Note that it is the caller's responsability to terminate this log file; it will not have an ending ] automatically written to the file. Until such a terminating character has been written, the log file is not compliant JSON.

      The intent for this feature (logging to json files) is for applications and commands that want to be able to process the log output. It is not an end user feature. Users have to be aware though, that if they try to log to a file having a .json suffix, the file will be in JSON format, and will be missing a closing bracket.


      It is difficult to use the logging system to output structured logs where values for file, line, position, issue-code etc. is output as separate and identifiable items (e.g. logging using JSON).

      This is needed for post-processing (searching, transforming) log output.

      The work includes adding required fields to the Log object, and to make sure the features that are already present in Puppet's logging framework gets used. Basiclly the responsibility to format the message with location (and other structural information) should be made by a logging destination (since it knows what the underlying technology expects; a formatted text string, or structured output.

      We want the pops issue based feature to integrate well with logging. It should probably bypass the simple text-based logging functions in favor of the underlying API where structured information can be passed to the Log object.

      As part of this, a :jsonfile destination should be implemented.

      qa risk assessment: medium
      probability: medium (only when migrating to 4x or using puppet preview)
      severity: medium (logging, workarounds exist)
      test layer: unit/integration


        Issue Links



              Unassigned Unassigned
              henrik.lindberg Henrik Lindberg
              0 Vote for this issue
              3 Start watching this issue



                Zendesk Support