Skip to content

Commit

Permalink
Merge 3e1daa4 into e46b047
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillipmartin committed Apr 5, 2017
2 parents e46b047 + 3e1daa4 commit 6f3f535
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config.go
Expand Up @@ -31,6 +31,7 @@ type pdnsConfig struct {
statsdPrefix string
syslogFacility string
syslogPriority string
syslogTag string
}

func initConfig() *pdnsConfig {
Expand Down Expand Up @@ -58,6 +59,7 @@ func initConfig() *pdnsConfig {
var statsdPrefix = flag.String("statsd_prefix", getEnvStr("PDNS_STATSD_PREFIX", "gopassivedns"), "statsd metric prefix") //gopassivedns
var syslogFacility = flag.String("syslog_facility", getEnvStr("PDNS_SYSLOG_FACILITY", ""), "syslog facility") //gopassivedns
var syslogPriority = flag.String("syslog_priority", getEnvStr("PDNS_SYSLOG_PRIORITY", "info"), "syslog priority") //gopassivedns
var syslogTag = flag.String("syslog_tag", getEnvStr("PDNS_SYSLOG_TAG", ""), "syslog tag")
var configFile = flag.String("config", getEnvStr("PDNS_CONFIG", ""), "config file")

flag.Parse()
Expand Down Expand Up @@ -103,6 +105,7 @@ func initConfig() *pdnsConfig {
statsdPrefix: *statsdPrefix,
syslogFacility: *syslogFacility,
syslogPriority: *syslogPriority,
syslogTag: *syslogTag,
}
}

Expand Down Expand Up @@ -146,4 +149,4 @@ func getEnvInt(name string, def int) int {
}else{
return def
}
}
}
4 changes: 3 additions & 1 deletion log.go
Expand Up @@ -24,6 +24,7 @@ type logOptions struct {
KafkaTopic string
SyslogFacility string
SyslogPriority string
SyslogTag string
closed bool
control chan string
}
Expand All @@ -40,6 +41,7 @@ func NewLogOptions(config *pdnsConfig) *logOptions {
MaxBackups: config.logMaxBackups,
SyslogFacility: config.syslogFacility,
SyslogPriority: config.syslogPriority,
SyslogTag: config.syslogTag,
}
}

Expand Down Expand Up @@ -227,7 +229,7 @@ func logConnSyslog(logC chan dnsLogEntry, opts *logOptions) {
log.Fatalf("string '%s' did not parse as a facility", opts.SyslogFacility)
}

logger, err := syslog.New(facility|level, "")
logger, err := syslog.New(facility|level, opts.SyslogTag)
if err != nil {
log.Fatalf("failed to connect to the local syslog daemon: %s", err)
}
Expand Down

0 comments on commit 6f3f535

Please sign in to comment.