diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index c334a6b28a6b..39a0e511984c 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -43,6 +43,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix panic in the Logstash output when trying to send events to closed connection. {pull}15568[15568] - Fix missing output in dockerlogbeat {pull}15719[15719] - Fix logging target settings being ignored when Beats are started via systemd or docker. {issue}12024[12024] {pull}15422[15442] +- Do not load dashboards where not available. {pull}15802[15802] *Auditbeat* diff --git a/auditbeat/cmd/root.go b/auditbeat/cmd/root.go index 64211fd70489..ae0b8e0d0ea2 100644 --- a/auditbeat/cmd/root.go +++ b/auditbeat/cmd/root.go @@ -47,6 +47,11 @@ func init() { ), ) var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError) - RootCmd = cmd.GenRootCmdWithSettings(create, instance.Settings{RunFlags: runFlags, Name: Name}) + settings := instance.Settings{ + RunFlags: runFlags, + Name: Name, + HasDashboards: true, + } + RootCmd = cmd.GenRootCmdWithSettings(create, settings) RootCmd.AddCommand(ShowCmd) } diff --git a/filebeat/cmd/root.go b/filebeat/cmd/root.go index 6235312c6817..3cb795a2ae17 100644 --- a/filebeat/cmd/root.go +++ b/filebeat/cmd/root.go @@ -42,7 +42,12 @@ func init() { var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError) runFlags.AddGoFlag(flag.CommandLine.Lookup("once")) runFlags.AddGoFlag(flag.CommandLine.Lookup("modules")) - RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{RunFlags: runFlags, Name: Name}) + settings := instance.Settings{ + RunFlags: runFlags, + Name: Name, + HasDashboards: true, + } + RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings) RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("M")) RootCmd.TestCmd.Flags().AddGoFlag(flag.CommandLine.Lookup("modules")) RootCmd.SetupCmd.Flags().AddGoFlag(flag.CommandLine.Lookup("modules")) diff --git a/heartbeat/cmd/root.go b/heartbeat/cmd/root.go index fe63c11e7e0b..80435dbc4b99 100644 --- a/heartbeat/cmd/root.go +++ b/heartbeat/cmd/root.go @@ -38,8 +38,9 @@ var RootCmd *cmd.BeatsRootCmd func init() { settings := instance.Settings{ - Name: Name, - Processing: processing.MakeDefaultSupport(true, processing.WithECS, processing.WithBeatMeta("agent")), + Name: Name, + Processing: processing.MakeDefaultSupport(true, processing.WithECS, processing.WithBeatMeta("agent")), + HasDashboards: false, } RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings) diff --git a/journalbeat/cmd/root.go b/journalbeat/cmd/root.go index fc0cf946f813..a276788d0849 100644 --- a/journalbeat/cmd/root.go +++ b/journalbeat/cmd/root.go @@ -32,4 +32,4 @@ import ( var Name = "journalbeat" // RootCmd to handle beats cli -var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name}) +var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name, HasDashboards: false}) diff --git a/libbeat/cmd/instance/beat.go b/libbeat/cmd/instance/beat.go index 3157c7acbdb7..b1bf04a1462e 100644 --- a/libbeat/cmd/instance/beat.go +++ b/libbeat/cmd/instance/beat.go @@ -518,7 +518,7 @@ func (b *Beat) Setup(settings Settings, bt beat.Creator, setup SetupSettings) er fmt.Println("Index setup finished.") } - if setup.Dashboard { + if setup.Dashboard && settings.HasDashboards { fmt.Println("Loading dashboards (Kibana must be running and reachable)") err = b.loadDashboards(context.Background(), true) diff --git a/libbeat/cmd/instance/settings.go b/libbeat/cmd/instance/settings.go index 138809557b02..7b7ab66706d4 100644 --- a/libbeat/cmd/instance/settings.go +++ b/libbeat/cmd/instance/settings.go @@ -32,6 +32,7 @@ type Settings struct { Name string IndexPrefix string Version string + HasDashboards bool Monitoring report.Settings RunFlags *pflag.FlagSet ConfigOverrides []cfgfile.ConditionalOverride diff --git a/libbeat/mock/mockbeat.go b/libbeat/mock/mockbeat.go index 22abab04570b..4a7dd1e01542 100644 --- a/libbeat/mock/mockbeat.go +++ b/libbeat/mock/mockbeat.go @@ -31,7 +31,7 @@ import ( var Version = "9.9.9" var Name = "mockbeat" -var Settings = instance.Settings{Name: Name, Version: Version} +var Settings = instance.Settings{Name: Name, Version: Version, HasDashboards: true} type Mockbeat struct { done chan struct{} diff --git a/magefile.go b/magefile.go index 955c1c632d4f..c09718d94d88 100644 --- a/magefile.go +++ b/magefile.go @@ -38,7 +38,6 @@ var ( // BeatsWithDashboards is a list of Beats to collect dashboards from. BeatsWithDashboards = []string{ "heartbeat", - "journalbeat", "packetbeat", "winlogbeat", "x-pack/auditbeat", diff --git a/metricbeat/cmd/root.go b/metricbeat/cmd/root.go index 9d13bf29867a..8fb81dc82627 100644 --- a/metricbeat/cmd/root.go +++ b/metricbeat/cmd/root.go @@ -44,7 +44,12 @@ var RootCmd *cmd.BeatsRootCmd func init() { var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError) runFlags.AddGoFlag(flag.CommandLine.Lookup("system.hostfs")) - RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), instance.Settings{RunFlags: runFlags, Name: Name}) + settings := instance.Settings{ + RunFlags: runFlags, + Name: Name, + HasDashboards: true, + } + RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), settings) RootCmd.AddCommand(cmd.GenModulesCmd(Name, "", BuildModulesManager)) RootCmd.TestCmd.AddCommand(test.GenTestModulesCmd(Name, "", beater.DefaultTestModulesCreator())) } diff --git a/packetbeat/cmd/root.go b/packetbeat/cmd/root.go index db742e9fe910..bb8479f5e5f6 100644 --- a/packetbeat/cmd/root.go +++ b/packetbeat/cmd/root.go @@ -44,6 +44,11 @@ func init() { runFlags.AddGoFlag(flag.CommandLine.Lookup("l")) runFlags.AddGoFlag(flag.CommandLine.Lookup("dump")) - RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{RunFlags: runFlags, Name: Name}) + settings := instance.Settings{ + RunFlags: runFlags, + Name: Name, + HasDashboards: true, + } + RootCmd = cmd.GenRootCmdWithSettings(beater.New, settings) RootCmd.AddCommand(genDevicesCommand()) } diff --git a/winlogbeat/cmd/root.go b/winlogbeat/cmd/root.go index 67cffcf9b8e9..2b230790915a 100644 --- a/winlogbeat/cmd/root.go +++ b/winlogbeat/cmd/root.go @@ -35,4 +35,4 @@ import ( var Name = "winlogbeat" // RootCmd to handle beats cli -var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name}) +var RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name, HasDashboards: true}) diff --git a/x-pack/functionbeat/manager/cmd/root.go b/x-pack/functionbeat/manager/cmd/root.go index aec510502130..1c4bafc66567 100644 --- a/x-pack/functionbeat/manager/cmd/root.go +++ b/x-pack/functionbeat/manager/cmd/root.go @@ -24,6 +24,7 @@ var RootCmd *cmd.BeatsRootCmd func init() { RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{ Name: Name, + HasDashboards: false, ConfigOverrides: config.Overrides, }) diff --git a/x-pack/metricbeat/cmd/root.go b/x-pack/metricbeat/cmd/root.go index 0acd6dbdc01c..0a4584889c6a 100644 --- a/x-pack/metricbeat/cmd/root.go +++ b/x-pack/metricbeat/cmd/root.go @@ -33,7 +33,12 @@ var RootCmd *cmd.BeatsRootCmd func init() { var runFlags = pflag.NewFlagSet(Name, pflag.ExitOnError) runFlags.AddGoFlag(flag.CommandLine.Lookup("system.hostfs")) - RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), instance.Settings{RunFlags: runFlags, Name: Name}) + settings := instance.Settings{ + RunFlags: runFlags, + Name: Name, + HasDashboards: true, + } + RootCmd = cmd.GenRootCmdWithSettings(beater.DefaultCreator(), settings) RootCmd.AddCommand(cmd.GenModulesCmd(Name, "", mbcmd.BuildModulesManager)) RootCmd.TestCmd.AddCommand(test.GenTestModulesCmd(Name, "", beater.DefaultTestModulesCreator())) xpackcmd.AddXPack(RootCmd, Name)