agent: Adding SyslogFacility configuration

This commit is contained in:
Armon Dadgar 2014-06-11 10:18:19 -07:00
parent ea054b8847
commit 648429288e
3 changed files with 15 additions and 1 deletions

View File

@ -167,6 +167,10 @@ type Config struct {
// on linux and OSX. Other platforms will generate an error.
EnableSyslog bool `mapstructure:"enable_syslog"`
// SyslogFacility is used to control where the syslog messages go
// By default, goes to LOCAL0
SyslogFacility string `mapstructure:"syslog_facility"`
// RejoinAfterLeave controls our interaction with the cluster after leave.
// When set to false (default), a leave causes Consul to not rejoin
// the cluster until an explicit join is received. If this is set to
@ -228,6 +232,7 @@ func DefaultConfig() *Config {
DNSConfig: DNSConfig{
MaxStale: 5 * time.Second,
},
SyslogFacility: "LOCAL0",
Protocol: consul.ProtocolVersionMax,
CheckUpdateInterval: 5 * time.Minute,
AEInterval: time.Minute,
@ -556,6 +561,9 @@ func MergeConfig(a, b *Config) *Config {
if b.CheckUpdateIntervalRaw != "" || b.CheckUpdateInterval != 0 {
result.CheckUpdateInterval = b.CheckUpdateInterval
}
if b.SyslogFacility != "" {
result.SyslogFacility = b.SyslogFacility
}
// Copy the start join addresses
result.StartJoin = make([]string, 0, len(a.StartJoin)+len(b.StartJoin))

View File

@ -270,7 +270,7 @@ func TestDecodeConfig(t *testing.T) {
}
// Syslog
input = `{"enable_syslog": true}`
input = `{"enable_syslog": true, "syslog_facility": "LOCAL4"}`
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
if err != nil {
t.Fatalf("err: %s", err)
@ -279,6 +279,9 @@ func TestDecodeConfig(t *testing.T) {
if !config.EnableSyslog {
t.Fatalf("bad: %#v", config)
}
if config.SyslogFacility != "LOCAL4" {
t.Fatalf("bad: %#v", config)
}
// Rejoin
input = `{"rejoin_after_leave": true}`

View File

@ -257,6 +257,9 @@ definitions support being updated during a reload.
Consul will stream various telemetry information to that instance for aggregation.
This can be used to capture various runtime information.
* `syslog_facility` - When `enable_syslog` is provided, this controls which
facility messages are sent to. By default, `LOCAL0` will be used.
* `verify_incoming` - If set to True, Consul requires that all incoming
connections make use of TLS, and that the client provides a certificate signed
by the Certificate Authority from the `ca_file`. By default, this is false, and