How does Apigee set the priority score in syslog messages in Message Logging policy

In Apigee Message Logging policy if <PayloadOnly>false</PayloadOnly> configuration is used, the Message Logging policy will include the priority score and the syslog version at the beginning of the log message.

An example (In INFO logs, the priority score is set to 14):

<14>1 2016-02-23T09:24:39.039+0000 e49cd3a9-4cf6-48a7-abb9-7ftfe4d97d00 Apigee - - - Message starts here
  • <14> - A priority score (see the Syslog Protocol) based on the log level and facility level of the message.
  • 1 - The current syslog version.

Apigee sets the priority score of each log entry using the following formula:

priorityScore = (facilityLevel << 3) | logLevel

Apigee considers all log messages published by Message Logging policy as user-level messages. Therefore, the facility level has been fixed to 1. You could find this information in Syslog protocol specification:

https://datatracker.ietf.org/doc/html/rfc5424

Thereafter, based on the log level of each log entry, priority score will be calculated according to the above formula:

LOG_LEVEL_ALERT = 1;
LOG_LEVEL_ERROR = 3;
LOG_LEVEL_WARN = 4;
LOG_LEVEL_INFO = 6;

facilityLevel = 1;
logLevel = LOG_LEVEL_ALERT;
priorityScore = (facilityLevel << 3) | logLevel;
priorityScore => 9

facilityLevel = 1;
logLevel = LOG_LEVEL_ERROR;
priorityScore = (facilityLevel << 3) | logLevel;
priorityScore => 11

facilityLevel = 1;
logLevel = LOG_LEVEL_WARN;
priorityScore = (facilityLevel << 3) | logLevel;
priorityScore => 12

facilityLevel = 1;
logLevel = LOG_LEVEL_INFO;
priorityScore = (facilityLevel << 3) | logLevel;
priorityScore => 14

References:

Comments
manucr619
Bronze 3
Bronze 3

Any update on this thread ?

Version history
Last update:
‎05-26-2021 11:50 PM
Updated by: