Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(665)

Unified Diff: utils/syslog/config.go

Issue 93270044: utils:syslog: state servers broadcast logs
Patch Set: utils:syslog: state servers broadcast logs Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cmd/jujud/agent.go ('k') | utils/syslog/config_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/syslog/config.go
=== modified file 'utils/syslog/config.go'
--- utils/syslog/config.go 2014-05-09 11:56:45 +0000
+++ utils/syslog/config.go 2014-05-12 10:28:29 +0000
@@ -43,14 +43,46 @@
// Instead we need to mess with the global FileCreateMode. We set it back
// to the ubuntu default after defining our rule.
const stateServerRsyslogTemplate = `
+$ModLoad imuxsock
$ModLoad imfile
+# Messages received from remote rsyslog machines have messages prefixed with a space,
+# so add one in for local messages too if needed.
+$template JujuLogFormat{{namespace}},"%syslogtag:{{tagStart}}:$%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
+
+$template LongTagForwardFormat,"<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%"
+
+$RuleSet local
+{{range $i, $stateServerIP := stateServerHosts}}
+# start: Forwarding rule for {{$stateServerIP}}
+$ActionQueueType LinkedList
+$ActionQueueFileName {{logfileName}}{{namespace}}_{{$i}}
+$ActionResumeRetryCount -1
+$ActionQueueSaveOnShutdown on
+$DefaultNetstreamDriver gtls
+$DefaultNetstreamDriverCAFile {{tlsCACertPath}}
+$ActionSendStreamDriverAuthMode anon
+$ActionSendStreamDriverMode 1 # run driver in TLS-only mode
+
+:syslogtag, startswith, "juju{{namespace}}-" @@{{$stateServerIP}}:{{portNumber}};LongTagForwardFormat
+# end: Forwarding rule for {{$stateServerIP}}
+{{end}}
+& ~
+$FileCreateMode 0640
+
+$RuleSet remote
+$FileCreateMode 0644
+:syslogtag, startswith, "juju{{namespace}}-" {{logDir}}/all-machines.log;JujuLogFormat{{namespace}}
+& ~
+$FileCreateMode 0640
+
$InputFilePersistStateInterval 50
$InputFilePollInterval 5
$InputFileName {{logfilePath}}
$InputFileTag juju{{namespace}}-{{logfileName}}:
$InputFileStateFile {{logfileName}}{{namespace}}
$InputRunFileMonitor
+$DefaultRuleset local
$ModLoad imtcp
$DefaultNetstreamDriver gtls
@@ -59,16 +91,9 @@
$DefaultNetstreamDriverKeyFile {{tlsKeyPath}}
$InputTCPServerStreamDriverAuthMode anon
$InputTCPServerStreamDriverMode 1 # run driver in TLS-only mode
+
+$InputTCPServerBindRuleset remote
$InputTCPServerRun {{portNumber}}
-
-# Messages received from remote rsyslog machines have messages prefixed with a space,
-# so add one in for local messages too if needed.
-$template JujuLogFormat{{namespace}},"%syslogtag:{{tagStart}}:$%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
-
-$FileCreateMode 0644
-:syslogtag, startswith, "juju{{namespace}}-" {{logDir}}/all-machines.log;JujuLogFormat{{namespace}}
-& ~
-$FileCreateMode 0640
`
// The rsyslog conf for non-state server nodes.
@@ -168,12 +193,13 @@
// NewAccumulateConfig creates a SyslogConfig instance used to accumulate log entries from the
// various unit nodes.
-func NewAccumulateConfig(logFile, logDir string, port int, namespace string) *SyslogConfig {
+func NewAccumulateConfig(logFile, logDir string, port int, namespace string, stateServerAddresses []string) *SyslogConfig {
conf := &SyslogConfig{
- configTemplate: stateServerRsyslogTemplate,
- LogFileName: logFile,
- Port: port,
- LogDir: logDir,
+ configTemplate: stateServerRsyslogTemplate,
+ LogFileName: logFile,
+ Port: port,
+ LogDir: logDir,
+ StateServerAddresses: stateServerAddresses,
}
if namespace != "" {
conf.Namespace = "-" + namespace
« no previous file with comments | « cmd/jujud/agent.go ('k') | utils/syslog/config_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b