diff --git a/client/driver/logcollector/collector_windows.go b/client/driver/logcollector/collector_windows.go new file mode 100644 index 000000000..e13c04b2b --- /dev/null +++ b/client/driver/logcollector/collector_windows.go @@ -0,0 +1,71 @@ +package logcollector + +import ( + "log" + + "github.com/hashicorp/nomad/client/allocdir" + "github.com/hashicorp/nomad/client/driver/executor" + "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 *executor.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/logcollector/parser.go b/client/driver/logcollector/parser.go index eeb910a6f..79ec96ae2 100644 --- a/client/driver/logcollector/parser.go +++ b/client/driver/logcollector/parser.go @@ -1,3 +1,5 @@ +// +build !windows + package logcollector import ( diff --git a/client/driver/logcollector/parser_test.go b/client/driver/logcollector/parser_test.go index 2c62049c5..dd43379ed 100644 --- a/client/driver/logcollector/parser_test.go +++ b/client/driver/logcollector/parser_test.go @@ -1,3 +1,5 @@ +// +build !windows + package logcollector import ( diff --git a/client/driver/logcollector/collector.go b/client/driver/logcollector/universal_collector.go similarity index 99% rename from client/driver/logcollector/collector.go rename to client/driver/logcollector/universal_collector.go index fab901428..35a5478c0 100644 --- a/client/driver/logcollector/collector.go +++ b/client/driver/logcollector/universal_collector.go @@ -1,3 +1,5 @@ +// +build !windows + package logcollector import ( diff --git a/client/driver/utils_posix.go b/client/driver/utils_posix.go index fef4a002f..ccaaeee1f 100644 --- a/client/driver/utils_posix.go +++ b/client/driver/utils_posix.go @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,!windows package driver