diff --git a/client/driver/executor/executor_unix.go b/client/driver/executor/executor_unix.go index 7c8ddf724..612a538c7 100644 --- a/client/driver/executor/executor_unix.go +++ b/client/driver/executor/executor_unix.go @@ -1,11 +1,12 @@ -// +build darwin dragonfly freebsd linux netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows package executor import ( "fmt" "io" - "log/syslog" + + syslog "github.com/RackSec/srslog" "github.com/hashicorp/nomad/client/driver/logging" ) diff --git a/client/driver/executor/executor_windows.go b/client/driver/executor/executor_windows.go deleted file mode 100644 index e93f936e7..000000000 --- a/client/driver/executor/executor_windows.go +++ /dev/null @@ -1,5 +0,0 @@ -package executor - -func (e *UniversalExecutor) LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error) { - return nil, nil -} diff --git a/client/driver/logging/collector_windows.go b/client/driver/logging/collector_windows.go deleted file mode 100644 index a3a3c1169..000000000 --- a/client/driver/logging/collector_windows.go +++ /dev/null @@ -1,71 +0,0 @@ -package logging - -import ( - "log" - - "github.com/hashicorp/nomad/client/allocdir" - cstructs "github.com/hashicorp/nomad/client/driver/structs" - "github.com/hashicorp/nomad/nomad/structs" -) - -// LogCollectorContext holds context to configure the syslog server -type LogCollectorContext struct { - // TaskName is the name of the Task - TaskName string - - // AllocDir is the handle to do operations on the alloc dir of - // the task - AllocDir *allocdir.AllocDir - - // LogConfig provides configuration related to log rotation - LogConfig *structs.LogConfig - - // PortUpperBound is the upper bound of the ports that we can use to start - // the syslog server - PortUpperBound uint - - // PortLowerBound is the lower bound of the ports that we can use to start - // the syslog server - PortLowerBound uint -} - -// SyslogCollectorState holds the address and islation information of a launched -// syslog server -type SyslogCollectorState struct { - IsolationConfig *cstructs.IsolationConfig - Addr string -} - -// LogCollector is an interface which allows a driver to launch a log server -// and update log configuration -type LogCollector interface { - LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error) - Exit() error - UpdateLogConfig(logConfig *structs.LogConfig) error -} - -// SyslogCollector is a LogCollector which starts a syslog server and does -// rotation to incoming stream -type SyslogCollector struct { -} - -// NewSyslogCollector returns an implementation of the SyslogCollector -func NewSyslogCollector(logger *log.Logger) *SyslogCollector { - return &SyslogCollector{} -} - -// LaunchCollector launches a new syslog server and starts writing log lines to -// files and rotates them -func (s *SyslogCollector) LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error) { - return nil, nil -} - -// Exit kills the syslog server -func (s *SyslogCollector) Exit() error { - return nil -} - -// UpdateLogConfig updates the log configuration -func (s *SyslogCollector) UpdateLogConfig(logConfig *structs.LogConfig) error { - return nil -} diff --git a/client/driver/logging/syslog_parser_unix.go b/client/driver/logging/syslog_parser.go similarity index 97% rename from client/driver/logging/syslog_parser_unix.go rename to client/driver/logging/syslog_parser.go index 4e0fec555..f65c510f0 100644 --- a/client/driver/logging/syslog_parser_unix.go +++ b/client/driver/logging/syslog_parser.go @@ -1,12 +1,13 @@ -// +build darwin dragonfly freebsd linux netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows package logging import ( "fmt" "log" - "log/syslog" "strconv" + + syslog "github.com/RackSec/srslog" ) // Errors related to parsing priority diff --git a/client/driver/logging/syslog_parser_unix_test.go b/client/driver/logging/syslog_parser_unix_test.go index 5aa3345ec..70e1b3091 100644 --- a/client/driver/logging/syslog_parser_unix_test.go +++ b/client/driver/logging/syslog_parser_unix_test.go @@ -5,9 +5,10 @@ package logging import ( "bytes" "log" - "log/syslog" "os" "testing" + + syslog "github.com/RackSec/srslog" ) func TestLogParser_Priority(t *testing.T) { diff --git a/client/driver/logging/syslog_server_unix.go b/client/driver/logging/syslog_server.go similarity index 98% rename from client/driver/logging/syslog_server_unix.go rename to client/driver/logging/syslog_server.go index 4fb450a8f..f059ef77b 100644 --- a/client/driver/logging/syslog_server_unix.go +++ b/client/driver/logging/syslog_server.go @@ -1,5 +1,3 @@ -// +build !windows - package logging import ( diff --git a/client/driver/logging/syslog_server_windows.go b/client/driver/logging/syslog_server_windows.go deleted file mode 100644 index cc6a60840..000000000 --- a/client/driver/logging/syslog_server_windows.go +++ /dev/null @@ -1,10 +0,0 @@ -package logging - -type SyslogServer struct { -} - -func (s *SyslogServer) Shutdown() { -} - -type SyslogMessage struct { -} diff --git a/client/driver/logging/universal_collector_unix.go b/client/driver/logging/universal_collector.go similarity index 98% rename from client/driver/logging/universal_collector_unix.go rename to client/driver/logging/universal_collector.go index 1db92fce4..8cc936def 100644 --- a/client/driver/logging/universal_collector_unix.go +++ b/client/driver/logging/universal_collector.go @@ -1,4 +1,4 @@ -// +build darwin dragonfly freebsd linux netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows package logging @@ -7,11 +7,11 @@ import ( "io" "io/ioutil" "log" - "log/syslog" "net" "os" "runtime" + syslog "github.com/RackSec/srslog" "github.com/hashicorp/nomad/client/allocdir" cstructs "github.com/hashicorp/nomad/client/driver/structs" "github.com/hashicorp/nomad/nomad/structs"