PingAuthorize

Enabling Mapped Diagnostic Context for Policy Editor logs

You can enable Mapped Diagnostic Context (MDC) in the default Policy Editor logs for enhanced visibility of application behavior.

About this task

MDC is a map of key-value pairs that you can use to enrich log messages. This can help when correlating log messages to a specific decision request. For example, if you want to correlate an HTTP service call recorded in the application logs to the decision request that invoked that service, you can use the decisionRequestId generated by MDC.

MDC log data is enabled by default in the File-based Trace Log Publisher in embedded policy decision point (PDP) mode.

The following table outlines the MDC keys available for each decision request type:

Decision request type Key Description

Individual requests

decisionRequestId

Unique ID for the decision request.

Batch requests

batchId

Unique ID for the batch request.

decisionRequestID

Unique ID for an individual decision request in the batch.

Policy query requests

queryId

Unique ID for the policy query request.

decisionRequestID

Unique ID for an individual decision request in the query request.

Steps

  1. Stop the Policy Editor.

    $ bin/stop-server
  2. In the PingAuthorize-PAP/config/configuration.yml file, add the %mdc configuration option to the logFormat field of the application log appenders section:

     appenders:
     - type: "console"
       threshold: "INFO"
       target: "stdout"
       logFormat: "%-5level [%date{ISO8601}] %c, %mdc: %msg%n"
     - type: "file"
       threshold: "DEBUG"
       currentLogFilename: "logs/debug.log"
       maxFileSize: "250MB"
       archive: true
       archivedLogFilenamePattern: "logs/debug.%i.log.gz"
       archivedFileCount: 10
       logFormat: "%-5level [%date{ISO8601}] [%thread] %c, %mdc: %msg%n"
     - type: "file"
       threshold: "INFO"
       currentLogFilename: "logs/authorize-pe.log"
       maxFileSize: "250MB"
       archive: true
       archivedLogFilenamePattern: "logs/authorize-pe.%i.log.gz"
       archivedFileCount: 10
       logFormat: "%-5level [%date{ISO8601}] %c,%mdc: %msg%n"
  3. Save your changes and restart the Policy Editor.

    $ bin/start-server