github.com/smithx10/nomad@v0.9.1-rc1/command/logmon_plugin.go (about) 1 package command 2 3 import ( 4 "strings" 5 6 hclog "github.com/hashicorp/go-hclog" 7 plugin "github.com/hashicorp/go-plugin" 8 "github.com/hashicorp/nomad/client/logmon" 9 "github.com/hashicorp/nomad/plugins/base" 10 ) 11 12 type LogMonPluginCommand struct { 13 Meta 14 } 15 16 func (e *LogMonPluginCommand) Help() string { 17 helpText := ` 18 This is a command used by Nomad internally to launch the logmon process" 19 ` 20 return strings.TrimSpace(helpText) 21 } 22 23 func (e *LogMonPluginCommand) Synopsis() string { 24 return "internal - launch a logmon plugin" 25 } 26 27 func (e *LogMonPluginCommand) Run(args []string) int { 28 logger := hclog.New(&hclog.LoggerOptions{ 29 Level: hclog.Trace, 30 JSONFormat: true, 31 Name: "logmon", 32 }) 33 plugin.Serve(&plugin.ServeConfig{ 34 HandshakeConfig: base.Handshake, 35 Plugins: map[string]plugin.Plugin{ 36 "logmon": logmon.NewPlugin(logmon.NewLogMon(logger)), 37 }, 38 GRPCServer: plugin.DefaultGRPCServer, 39 Logger: logger, 40 }) 41 return 0 42 }