We are evaluating rsyslog and syslog-ng for a multiplatform deployment. Each of the platforms will have the same rsyslog.conf file. Platforms are running CentOS linux. We are evaluating Rsyslog-3.18.2
The platforms will receive syslog from serveral Cisco Servers. We want to use unique locations for messages from each server and to that end have used one of the Wiki configs that uses the scripting language of rsyslog to do this.
The problem we are running into is that we would like the locally generated syslog to go to the traditional linux locations (/var/log/messages etc) and the script example attempts to do that, but it relies on the idea that the syslog "source" tag will be "localhost". In our case, the "source" contains the System hostname which is different for each box.
We would like to eliminate as many specially customized files to build one of these platforms. So the question is this.
Is there away to capture the hostname of the platform within the rsyslog.conf file and then use that in the compare against "source" to determine if the syslog message is local or not?
Ie something like
#Get hostname from shell command
my_hostname='hostname'
if \
$source == $my_hostname \
and ( \
$syslogseverity-text == 'info' \
or \
$syslogseverity-text == 'notice' \
) \
and ( \
$syslogfacility-text != 'mail' \
and \
$syslogfacility-text != 'authpriv' \
and \
$syslogfacility-text != 'cron' \
) \
then /var/log/messages


