# The PRI message part

New to AxoSyslog? AxoSyslog is a binary compatible `syslog-ng` replacement, from the original creator, developed by the same team.

Same architecture, same config files, same paths. Cloud-native images, fast releases, modern observability (OTel, K8s), and powerful data processing: read more about the [differences between AxoSyslog and `syslog-ng`](<https://axoflow.com/axosyslog-vs-syslog-ng?utm_source=docs&utm_medium=banner>).

Also, it’s super easy to [install](../../../docs/axosyslog-core/install/index.md), and you can [upgrade from `syslog-ng` in minutes](../../../docs/axosyslog-core/install/upgrade-syslog-ng/index.md).

This section describes the `PRI` (priority) part of a syslog message, which encodes the message’s facility and severity. The `PRI` is used the same way by the [BSD-syslog](<https://datatracker.ietf.org/doc/rfc3164/>) and [IETF-syslog](<https://tools.ietf.org/html/rfc5424>) protocols.

## The PRI message part

The `PRI` part of the syslog message (known as Priority value) represents the Facility and Severity of the message. Facility represents the part of the system sending the message, while Severity marks its importance.

## PRI formula

The Priority value is calculated using the following formula:
```
 
       <PRI> = ( <facility> * 8) + <severity> 
    
```

That is, you first multiply the Facility number by 8, and then add the numerical value of the Severity to the multiplied sum.

## Example: the correlation between facility value, severity value, and the Priority value in the PRI message part

The following example illustrates a sample syslog message with a sample `PRI` field (that is, Priority value):
```
 
       <133> Feb 25 14:09:07 webserver syslogd: restart
    
```

In this example, `<133>` represents the `PRI` field (Priority value). The syslog message’s Facility value is `16`, and the Severity value is `5`.

Substituting the numerical values into the `<PRI>` = ( `<facility>` * `8`) + `<severity>` formula, the results match the Priority value in our example:

`<133>` = ( `<16>` * `8`) + `<5>`.

## Facility and Severity values

The possible Facility values (between `0` and `23`) and Severity values (between `0` and `7`) each correspond to a message type (see [Table 1: syslog Message Facilities](../../../docs/axosyslog-core/chapter-concepts/concepts-message-structure/concepts-message-pri/index.md#facility-codes)), or a message importance level (see [Table 2: syslog Message Severities](../../../docs/axosyslog-core/chapter-concepts/concepts-message-structure/concepts-message-pri/index.md#severity-codes)).

Note Facility and severity are set by the sender and used inconsistently, and their names have varied across platforms over time, so a code’s name or description is not a reliable indicator of the message. The descriptions follow RFC 5424, while the macro values are the traditional BSD names. AxoSyslog also accepts Facility codes as numerical values. 

## syslog Message Facilities

The following table lists possible Facility values. The `Name` column shows the [`${FACILITY}`](../../../docs/axosyslog-core/chapter-manipulating-messages/customizing-message-format/reference-macros/index.md#macro-facility) macro value.

Numerical Code (`${FACILITY_NUM}`) | Name (`${FACILITY}`) | Facility  
---|---|---  
0 | `kern` | kernel messages  
1 | `user` | user-level messages  
2 | `mail` | mail system  
3 | `daemon` | system daemons  
4 | `auth` | security/authorization messages  
5 | `syslog` | messages generated internally by syslogd  
6 | `lpr` | line printer subsystem  
7 | `news` | network news subsystem  
8 | `uucp` | UUCP subsystem  
9 | `cron` | clock daemon  
10 | `authpriv` | security/authorization messages  
11 | `ftp` | FTP daemon  
12 | `ntp` | NTP subsystem  
13 | `security` | log audit  
14 | `console` | log alert  
15 | `solaris-cron` | clock daemon  
16-23 | `local0`-`local7` | locally used facilities (local0-local7)  
  
## syslog Message Severities

The following table lists possible Severity values. The `Name` column shows the [`${SEVERITY}`](../../../docs/axosyslog-core/chapter-manipulating-messages/customizing-message-format/reference-macros/index.md#macro-priority) macro value (`${LEVEL}` and `${PRIORITY}` are aliases).

Numerical Code (`${LEVEL_NUM}`) | Name (`${SEVERITY}`) | Severity  
---|---|---  
0 | `emerg` | Emergency: system is unusable  
1 | `alert` | Alert: action must be taken immediately  
2 | `crit` | Critical: critical conditions  
3 | `err` | Error: error conditions  
4 | `warning` | Warning: warning conditions  
5 | `notice` | Notice: normal but significant condition  
6 | `info` | Informational: informational messages  
7 | `debug` | Debug: debug-level messages  
  
Note A message that arrives without a PRI — from a non-syslog source such as [OpenTelemetry](../../../docs/axosyslog-core/chapter-sources/opentelemetry/index.md) or a file, or a syslog message that omits the `<PRI>` field — defaults to facility `user` and severity `notice` (PRI `13`). Use the source’s [`default-facility()`](../../../docs/axosyslog-core/chapter-sources/configuring-sources-network/reference-source-network/index.md#default-facility) and [`default-priority()`](../../../docs/axosyslog-core/chapter-sources/configuring-sources-network/reference-source-network/index.md#default-priority) options to change this. 

## Setting the facility and severity

To override the facility and severity of a message, use the [`set-facility()`](../../../docs/axosyslog-core/chapter-manipulating-messages/modifying-messages/rewrite-set-facility/index.md) and [`set-severity()`](../../../docs/axosyslog-core/chapter-manipulating-messages/modifying-messages/rewrite-set-severity/index.md) rewrite rules:
```
 
    rewrite r_pri {
        set-facility("local0");
        set-severity("err");
    };
    
```

With [FilterX](../../../docs/axosyslog-core/filterx/index.md), set the combined PRI value with [`set_pri()`](../../../docs/axosyslog-core/filterx/function-reference/index.md#set-pri) (`facility * 8 + severity`, so `local0` (16) and `err` (3) give `131`):
```
 
    filterx {
        set_pri(131);
    };
    
```

Both examples set the message to `local0.err`. Assigning the macros directly (such as `$SEVERITY` or `$PRIORITY`) does not work — they are read-only, macro-based values.

Last modified July 24, 2026: [Apply review suggestions: anchored relref/xref links (cef3eb2a)](<https://github.com/axoflow/axosyslog-core-docs/commit/cef3eb2aca222936185f262b573441ee9d3210f8>)