Improve Orbit debug logging (#3687)

Log reasons for runners terminating.
This commit is contained in:
Zach Wasserman 2022-01-13 16:54:28 -08:00 committed by GitHub
parent dc8e7cd4db
commit ef42199c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View File

@ -382,7 +382,7 @@ func main() {
}
if err := app.Run(os.Args); err != nil {
log.Error().Err(err).Msg("")
log.Error().Err(err).Msg("run orbit failed")
}
}

View File

@ -121,7 +121,7 @@ func WithLogPath(path string) func(*Runner) error {
// process may not be restarted after exit. Instead create a new one with
// NewRunner.
func (r *Runner) Execute() error {
log.Info().Str("cmd", r.cmd.String()).Msg("run osqueryd")
log.Info().Str("cmd", r.cmd.String()).Msg("start osqueryd")
ctx, cancel := context.WithCancel(context.Background())
r.cancel = cancel
@ -139,7 +139,7 @@ func (r *Runner) Execute() error {
// Runner interrupts the running osquery process.
func (r *Runner) Interrupt(err error) {
log.Debug().Msg("interrupt osquery")
log.Debug().Err(err).Msg("interrupt osquery")
r.cancel()
}

View File

@ -29,6 +29,8 @@ func NewRunner(socket string) *Runner {
// Execute creates an osquery extension manager server and registers osquery plugins.
func (r *Runner) Execute() error {
log.Debug().Msg("start osquery extension")
if err := waitForSocket(r.socket, 1*time.Minute); err != nil {
return err
}
@ -75,7 +77,7 @@ func (r *Runner) Execute() error {
// Interrupt shuts down the osquery manager server.
func (r *Runner) Interrupt(err error) {
log.Debug().Msg("interrupt osquery extension")
log.Debug().Err(err).Msg("interrupt osquery extension")
r.cancel()
if r.srv != nil {

View File

@ -66,6 +66,8 @@ func NewRunner(client *Updater, opt RunnerOptions) (*Runner, error) {
// Execute begins a loop checking for updates.
func (r *Runner) Execute() error {
log.Debug().Msg("start updater")
ticker := time.NewTicker(r.opt.CheckInterval)
defer ticker.Stop()
@ -150,5 +152,5 @@ func (r *Runner) updateTarget(target, channel string) error {
func (r *Runner) Interrupt(err error) {
r.cancel <- struct{}{}
log.Debug().Msg("interrupt updater")
log.Debug().Err(err).Msg("interrupt updater")
}