Skip to content

Instantly share code, notes, and snippets.

@thbishop
Created December 21, 2010 21:30
Show Gist options
  • Select an option

  • Save thbishop/750648 to your computer and use it in GitHub Desktop.

Select an option

Save thbishop/750648 to your computer and use it in GitHub Desktop.
Creates a facility/severity map of all of the possible syslog priorities
facility = { 0 => 'kern',
1 => 'user',
2 => 'mail',
3 => 'daemon',
4 => 'auth',
5 => 'syslog',
6 => 'lpr',
7 => 'news',
8 => 'uucp',
9 => 'cron',
10 => 'authpriv',
11 => 'ftp',
12 => 'ntp',
13 => 'audit',
14 => 'alert',
15 => 'clock',
16 => 'local0',
17 => 'local1',
18 => 'local2',
19 => 'local3',
20 => 'local4',
21 => 'local5',
22 => 'local6',
23 => 'local7' }
severity = { 0 => 'emerg',
1 => 'alert',
2 => 'crit',
3 => 'err',
4 => 'warning',
5 => 'notice',
6 => 'info',
7 => 'debug' }
priority_levels = (0..191).to_a
results = {}
priority_levels.each do |priority|
results[priority] = { 'facility' => facility[(priority / 8)], 'severity' => severity[(priority - ((priority / 8) * 8))] }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment