8.5.2. Enabling Application and Gear Context in Node Component Logs

Further context, such as application names and gear UUIDs, can be included in log messages from node components, which adds visibility by associating entries with specific applications or gears. This can also improve the ability to correlate log entries using reference IDs from the broker.

Procedure 8.1. To Enable Application and Gear Context in Apache Logs:

  1. Configure Apache to include application names and gear UUIDs in its log messages by editing the /etc/sysconfig/httpd file and adding the following line:
    OPTIONS="-DOpenShiftAnnotateFrontendAccessLog"

    Important

    All options must be on the same line. For example, in Section 8.8.2, “Enabling Syslog for Node Components” another option for Apache log files is explained. If both options are desired, the line must use the following syntax:
    OPTIONS="-Option1 -Option2"
  2. Restart the httpd service for the Apache changes to take effect for new applications:
    # service httpd restart

Procedure 8.2. To Enable Application and Gear Context in Node Platform Logs:

  1. Configure the node platform to include application and gear context in its log messages by editing the /etc/openshift/node.conf file and adding the following line:
    PLATFORM_LOG_CONTEXT_ENABLED=1
  2. Add the following line to specify which attributes are included. Set any or all of the following options in a comma-delimited list:
    PLATFORM_LOG_CONTEXT_ATTRS=request_id,container_uuid,app_uuid
    This produces key-value pairs for the specified attributes. If no context attribute configuration is present, all context attributes are printed.
  3. Restart the ruby193-mcollective service for the node platform changes to take effect:
    # service ruby193-mcollective restart