Use IP based regex for rsyslog

From rsyslogd documentation:

  fromhost
    hostname of the system the message was received from
    (in a relay chain, this is the system immediately in
    front of us and not necessarily the original sender).
    This is a DNS-resolved name, except if that is not
    possible or DNS resolution has been disabled.

So it might be either hostname or IP address, however,
regex filter will work for IP address only.

This commit forces IP usage of IP addresses only.

Closes-Bug: #1523488

Change-Id: I46e00f0273671a92126ce29a5bcebac257bedf03
This commit is contained in:
Ivan Suzdal 2015-12-08 19:55:08 +03:00 committed by Dmitry Teselkin
parent 134d640af1
commit d71c9b864b
1 changed files with 3 additions and 3 deletions

View File

@ -11,9 +11,9 @@ $Template RemoteLog, "%timegenerated:1:15:date-rfc3164% %syslogseverity-text%: %
$ActionFileDefaultTemplate RemoteLog
# Would match 'kernel:' -> 'kernel' ; 'rsyslogd[12345]:' -> 'rsyslogd' ; '<180>(nova.api.wsgi):' -> 'nova.api.wsgi' ; 'install/anaconda' -> 'install/anaconda'
$template RemoteLogFile, "/var/log/remote/%FROMHOST%/%syslogtag:R,ERE,1,DFLT:([A-Za-z][A-Za-z0-9_./-]*)--end%.log"
$template RemoteLogFile, "/var/log/remote/%fromhost-ip%/%syslogtag:R,ERE,1,DFLT:([A-Za-z][A-Za-z0-9_./-]*)--end%.log"
# Hardcode destination for puppet logs
$template PuppetApplyLogFile, "/var/log/remote/%FROMHOST%/puppet-apply.log"
$template PuppetApplyLogFile, "/var/log/remote/%fromhost-ip%/puppet-apply.log"
# Parse puppet logs
:syslogtag, regex, "puppet-user" ?PuppetApplyLogFile;RemoteLog
@ -21,5 +21,5 @@ $template PuppetApplyLogFile, "/var/log/remote/%FROMHOST%/puppet-apply.log"
:syslogtag, regex, "puppet-error" ?PuppetApplyLogFile;RemoteLog
&~
:FROMHOST, regex, "^[1-9]" ?RemoteLogFile;RemoteLog
:fromhost-ip, regex, "^[1-9]" ?RemoteLogFile;RemoteLog
&~