Skip to content

Commit

Permalink
Osquerybeat: Change the query timeout from 3 secs to 60 secs (#26775)
Browse files Browse the repository at this point in the history
* The 3 seconds timeout was too low for wifi_survey query for example
  which was taking more like 5 seconds on the test box. Bumping the
  value up eliminited timeouts.
  • Loading branch information
aleksmaus authored Jul 7, 2021
1 parent c0b75e9 commit 1754f54
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions x-pack/osquerybeat/beater/osquerybeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const (
// The interval in second for configuration refresh;
// osqueryd child process requests configuration from the configuration plugin implemented in osquerybeat
configurationRefreshIntervalSecs = 60

osqueryTimeout = 60 * time.Second
)

const (
Expand Down Expand Up @@ -176,7 +178,7 @@ func (bt *osquerybeat) Run(b *beat.Beat) error {
// Create osqueryd client
cli := osqdcli.New(socketPath,
osqdcli.WithLogger(bt.log),
osqdcli.WithTimeout(3*time.Second),
osqdcli.WithTimeout(osqueryTimeout),
osqdcli.WithCache(cache, adhocOsqueriesTypesCacheSize),
)

Expand All @@ -201,7 +203,7 @@ func (bt *osquerybeat) Run(b *beat.Beat) error {

// Start osquery extensions for logger and configuration
g.Go(func() error {
return runExtensionServer(ctx, socketPath, configPlugin, loggerPlugin)
return runExtensionServer(ctx, socketPath, configPlugin, loggerPlugin, osqueryTimeout)
})

// Register action handler
Expand Down Expand Up @@ -246,9 +248,9 @@ func (bt *osquerybeat) Run(b *beat.Beat) error {
return g.Wait()
}

func runExtensionServer(ctx context.Context, socketPath string, configPlugin *ConfigPlugin, loggerPlugin *LoggerPlugin) (err error) {
func runExtensionServer(ctx context.Context, socketPath string, configPlugin *ConfigPlugin, loggerPlugin *LoggerPlugin, timeout time.Duration) (err error) {
// Register config and logger extensions
extserver, err := osquery.NewExtensionManagerServer(extManagerServerName, socketPath)
extserver, err := osquery.NewExtensionManagerServer(extManagerServerName, socketPath, osquery.ServerTimeout(timeout))
if err != nil {
return
}
Expand Down

0 comments on commit 1754f54

Please sign in to comment.