Hi, 

you can use environmental variables in the configuration of syslog-ng, the $HOSTNAME variable should do the trick. See https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/config-global-variables.html

HTH, 

Robert

On Tue, Jan 3, 2017 at 4:21 PM, Broome, John P - OASAM OCIO CTR <Broome.John.P@dol.gov> wrote:

I am supporting a large number of syslog-ng hosts and we manage the configuration files with gitlab.  I have been trying to figure out how to reference a variable based on hostname in the syslog-ng.conf file on each machine.  For example, I would like to be able to have an include statement based on hostname – this would allow our common repository to have an exception set of filters/rules for each host but to use the exact same syslog-ng.conf file everywhere:

 

################################## syslog-ng.conf ###########################################

@version: 3.2

Include “`hostname`.conf”

 

Is there a way to accomplish this in version 3.2 (if not, does it appear in a later version)?

We are restricted to EPEL6 included versions of syslog-ng, so that’s why we’re at version 3.2

 

-           JB

 

 


______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq