Skip to content

Commit

Permalink
Fix issue with x-pack/metricbeat not using base settings. (#38959)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre HILBERT <[email protected]>
  • Loading branch information
blakerouse and pierrehilbert authored Apr 16, 2024
1 parent 2d73978 commit 3f1d32b
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions x-pack/metricbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
package cmd

import (
"flag"
"fmt"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/elastic/beats/v7/libbeat/cmd"
"github.com/elastic/beats/v7/libbeat/cmd/instance"
"github.com/elastic/beats/v7/libbeat/ecs"
"github.com/elastic/beats/v7/libbeat/processors"
"github.com/elastic/beats/v7/libbeat/publisher/processing"
Expand Down Expand Up @@ -47,19 +44,13 @@ var withECSVersion = processing.WithFields(mapstr.M{
})

func init() {
var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError)
runFlags.AddGoFlag(flag.CommandLine.Lookup("system.hostfs"))
globalProcs, err := processors.NewPluginConfigFromList(defaultProcessors())
if err != nil { // these are hard-coded, shouldn't fail
panic(fmt.Errorf("error creating global processors: %w", err))
}
settings := instance.Settings{
RunFlags: runFlags,
Name: Name,
HasDashboards: true,
ElasticLicensed: true,
Processing: processing.MakeDefaultSupport(true, globalProcs, withECSVersion, processing.WithHost, processing.WithAgentMeta()),
}
settings := mbcmd.MetricbeatSettings()
settings.ElasticLicensed = true
settings.Processing = processing.MakeDefaultSupport(true, globalProcs, withECSVersion, processing.WithHost, processing.WithAgentMeta())
RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), settings)
RootCmd.AddCommand(cmd.GenModulesCmd(Name, "", mbcmd.BuildModulesManager))
RootCmd.TestCmd.AddCommand(test.GenTestModulesCmd(Name, "", beater.DefaultTestModulesCreator()))
Expand Down

0 comments on commit 3f1d32b

Please sign in to comment.