syslog协议的第一部分是尖括号引用的一个数字,如: <182>
该数字大小范围为: 0 ~ 255, 为1个字节表达的数字,包含两部分内容:
低三位: (0 ~ 7)称作: Severity
1 2 3 4 5 6 7 8 9 10 11 |
Numerical Severity Code 0 Emergency: system is unusable 1 Alert: action must be taken immediately 2 Critical: critical conditions 3 Error: error conditions 4 Warning: warning conditions 5 Notice: normal but significant condition 6 Informational: informational messages 7 Debug: debug-level messages |
高5位(右移3位后): (0 ~ 31)称作:Facility
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
Numerical Facility Code 0 kernel messages 1 user-level messages 2 mail system 3 system daemons 4 security/authorization messages (note 1) 5 messages generated internally by syslogd 6 line printer subsystem 7 network news subsystem 8 UUCP subsystem 9 clock daemon (note 2) 10 security/authorization messages (note 1) 11 FTP daemon 12 NTP subsystem 13 log audit (note 1) 14 log alert (note 1) 15 clock daemon (note 2) 16 local use 0 (local0) 17 local use 1 (local1) 18 local use 2 (local2) 19 local use 3 (local3) 20 local use 4 (local4) 21 local use 5 (local5) 22 local use 6 (local6) 23 local use 7 (local7) |
根据尖括号中的数字还原上面两个部分的方法,以 182 为例:
1 2 3 4 |
lijunjiedeMacBook-Pro:~ phpor$ php -r 'echo 182 & 0x07;' 6 lijunjiedeMacBook-Pro:~ phpor$ php -r 'echo (182 >> 3) & 0x1f;' 22 |
即: local6的information