[syslog-ng] if condition

Alexey Vlasov renton at renton.name
Thu Aug 15 16:06:28 UTC 2019


Hi,

I would like to optimize my syslong-ng.conf file thus it could be used
on some boxes without any changing. 
Now I have a few modifications of syslong-ng.conf on each server to copy
logs to remote box.

For example, group of hosts A*
==============================
A1-machine (it is its hostname) has:
destination clnt { udp("remote-box-a" port(514)); };
log { source(src); filter(f_messages); destination(clnt); }; 
==============================

==============================
A2-machine has:
destination clnt { udp("remote-box-a" port(514)); };
log { source(src); filter(f_messages); destination(clnt); };
==============================

and group of hosts B*

==============================
B1-machine has:
destination clnt { udp("remote-box-b" port(514)); };
log { source(src); filter(f_messages); destination(clnt); };
==============================

==============================
B2-machine has:
destination clnt { udp("remote-box-b" port(514)); };
log { source(src); filter(f_messages); destination(clnt); };
==============================

Is there possible to write something like that

If (${HOSTNAME} ~ ^A) use remote-box-a
If (${HOSTNAME} ~ ^B) use remote-box-b

Thanks in advance!


More information about the syslog-ng mailing list