Skip to content

Commit

Permalink
move DNS name mapping to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ytti committed Oct 19, 2019
1 parent 836c03e commit ccf6291
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions extra/syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Config
CFGS.default.syslogd.port = 514
CFGS.default.syslogd.file = 'messages'
CFGS.default.syslogd.resolve = true
CFGS.default.syslogd.dns_map = {
'(.*)\.strip\.this\.domain\.com' => '\\1',
'(.*)\.also\.this\.net' => '\\1'
}

begin
CFGS.load
Expand All @@ -46,10 +50,6 @@ class Config
end

class SyslogMonitor
NAME_MAP = {
/(.*)\.ip\.tdc\.net/ => '\1',
/(.*)\.ip\.fi/ => '\1'
}.freeze
MSG = {
ios: /%SYS-(SW[0-9]+-)?5-CONFIG_I:/,
junos: 'UI_COMMIT:',
Expand Down Expand Up @@ -137,7 +137,7 @@ def getname(ipaddr)
ipaddr
else
name = (Resolv.getname ipaddr.to_s rescue ipaddr)
NAME_MAP.each { |re, sub| name.sub! re, sub }
Oxidized::CFG.syslogd.dns_map.each { |re, sub| name.sub! Regexp.new(re), sub }
name
end
end
Expand Down

0 comments on commit ccf6291

Please sign in to comment.