Well-formed syslog message headers start with the facility and severity encoded as the priority in angle brackets, e.g. <179>...
. As per RFC5424:
The Priority value is calculated by first multiplying the Facility number by 8 and then adding the numerical value of the Severity.
The python files in this gist are a demo to help showcase how to decode the priority. E.g.:
pri = 179
fac = (int)(pri / 8)
sev = pri % 8
Code samples:
decode_syslog_pri_simple.py
provides an MVP demo.decode_syslog_pri.py
provides a more complete object-oriented demo with lookups to human readable keywords for each facility and severity.
Reference:
GitHub gists don't correctly support relative links. Either navigate directly to the files, or use the gist-usable links below.