
This configuration assumes that
your configuration of syslog-ng has the main source named src.
you want your various clusters to log on local5, local6, and local7.
your central log server is named logserver
This allows you to run tests simultaneously on three different clusters, and still keep their log files separate.
Add this to the end of /etc/syslog-ng/syslog-ng.conf on every node in the cluster.
#
# Heartbeat logging for CTS
#
# Basic definitions: use port 9999 for syslog-ng logging
# When forwarding, forward to 'logserver'.
source s_tcp { tcp(port(9999) max-connections(32)); };
destination ha_tcp { tcp(logserver port(9999));};
# Filters for messages on local7
filter f_ha7 { facility(local7); };
filter f_ha_tcp7 { facility(local7); };
# Log local7 locally in /var/log/ha-log-local7, and forward to
# 'ha_tcp' from above (i.e., logserver)
destination ha_local7 { file("/var/log/ha-log-local7" perm(0644)); };
log { source(src); filter(f_ha_tcp7); destination(ha_tcp); };
log { source(src); source(s_tcp); filter(f_ha7); destination(ha_local7); };
#
# If you only want to test one cluster at a time, you can stop now...
#
# Filters for messages on local6
filter f_ha6 { facility(local6); };
filter f_ha_tcp6 { facility(local6); };
# Log local6 locally in /var/log/ha-log-local6, and forward to
# 'ha_tcp' from above (i.e., logserver)
destination ha_local6 { file("/var/log/ha-log-local6" perm(0644)); };
log { source(src); filter(f_ha_tcp6); destination(ha_tcp); };
log { source(src); source(s_tcp); filter(f_ha6); destination(ha_local6); };
# Filters for messages on local6
filter f_ha5 { facility(local5); };
filter f_ha_tcp5 { facility(local5); };
# Log local5 locally in /var/log/ha-log-local5, and forward to
# 'ha_tcp' from above (i.e., logserver)
destination ha_local5 { file("/var/log/ha-log-local5" perm(0644)); };
log { source(src); filter(f_ha_tcp5); destination(ha_tcp); };
In english, this sends everything logged to the local7 facility to the machine logserver. In addition, it will send everything logged to the local7 facility to /var/log/ha-log-local7. In the case of the machine logserver, this will include everything sent from the other cluster nodes.
NOTE: src refers to logs that originate locally on your machine. The name used in your distro may vary. To run CTS with stonith enable, syslog-ng should be started automatically before heartbeat starts.
Most of this was directly derived from AndrewBeekhof[1]'s description of how to do this.
CTS[2]
| [1] | http://www.linux-ha.org/AndrewBeekhof |
| [2] | http://www.linux-ha.org/cts |
This information provided courtesy of the Linux-HA project at http://linux-ha.org/