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

Add support for structured logging

    XMLWordPrintable

Details

    • 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

    Description

      UPDATE

      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.

      ORIGINAL


      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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support