From e6e2c0ee6f9d1a12a4b3b40825b5d7f83ea0a5e7 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 31 May 2021 16:15:48 +0200 Subject: [PATCH 1/5] disable kibana if running in managed mode --- beater/beater.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beater/beater.go b/beater/beater.go index fda73a4b5fe..3f7d1422136 100644 --- a/beater/beater.go +++ b/beater/beater.go @@ -308,6 +308,11 @@ func newServerRunner(ctx context.Context, args serverRunnerParams) (*serverRunne if cfg.DataStreams.Enabled && args.KibanaConfig != nil { cfg.Kibana.ClientConfig = *args.KibanaConfig } + if args.Beat.Manager != nil && args.Beat.Manager.Enabled() { + // If we're running in managed mode we do not want to + // communicate with kibana. + cfg.Kibana.Enabled = false + } runServerContext, cancel := context.WithCancel(ctx) return &serverRunner{ From 2083922541c0fe02a51becd102a5de6d873babbf Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 31 May 2021 16:16:06 +0200 Subject: [PATCH 2/5] if kibana disabled use direct agent config --- agentcfg/fetch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agentcfg/fetch.go b/agentcfg/fetch.go index 6c9a80bbd0e..1e2f1e90503 100644 --- a/agentcfg/fetch.go +++ b/agentcfg/fetch.go @@ -65,7 +65,7 @@ type Fetcher interface { // NewFetcher returns a new Fetcher based on the provided config. func NewFetcher(cfg *config.Config) Fetcher { - if cfg.AgentConfigs != nil { + if cfg.AgentConfigs != nil || !cfg.Kibana.Enabled { // Direct agent configuration is present, disable communication // with kibana. return NewDirectFetcher(cfg.AgentConfigs) From 978acd44ad0eb76f8dd4f7ce9ff6f1d82e007ba4 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 31 May 2021 16:16:25 +0200 Subject: [PATCH 3/5] remove agent_config service validation selecting "all" for service name or environment in the kibana ui marshals service.name and service.environment as empty strings, which is valid --- beater/config/config.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/beater/config/config.go b/beater/config/config.go index 07f1c5ac047..2025970ae34 100644 --- a/beater/config/config.go +++ b/beater/config/config.go @@ -43,7 +43,6 @@ const ( ) var ( - errInvalidAgentConfigServiceName = errors.New("agent_config: either service.name or service.environment must be set") errInvalidAgentConfigMissingConfig = errors.New("agent_config: no config set") ) @@ -113,9 +112,6 @@ type AgentConfig struct { } func (s *AgentConfig) setup() error { - if !s.Service.isValid() { - return errInvalidAgentConfigServiceName - } if s.Config == nil { return errInvalidAgentConfigMissingConfig } @@ -148,10 +144,6 @@ func (s *Service) String() string { return strings.Join([]string{name, env}, " ") } -func (s *Service) isValid() bool { - return s.Name != "" || s.Environment != "" -} - // ExpvarConfig holds config information about exposing expvar type ExpvarConfig struct { Enabled *bool `config:"enabled"` From 8aa3ad19991b6ba1b1c911c0e7ed69880a3311dd Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Tue, 1 Jun 2021 13:45:51 +0200 Subject: [PATCH 4/5] remove kibana api key this was used temporarily to support central config via kibana, which is not necessary for 7.14 --- apmpackage/apm/0.3.0/agent/input/template.yml.hbs | 2 -- apmpackage/apm/0.3.0/manifest.yml | 6 ------ 2 files changed, 8 deletions(-) diff --git a/apmpackage/apm/0.3.0/agent/input/template.yml.hbs b/apmpackage/apm/0.3.0/agent/input/template.yml.hbs index 0e181262004..62f822b8d5d 100644 --- a/apmpackage/apm/0.3.0/agent/input/template.yml.hbs +++ b/apmpackage/apm/0.3.0/agent/input/template.yml.hbs @@ -4,8 +4,6 @@ apm-server: max_event_size: {{max_event_bytes}} capture_personal_data: {{capture_personal_data}} default_service_environment: {{default_service_environment}} - kibana: - api_key: {{kibana_api_key}} rum: enabled: {{enable_rum}} source_mapping.elasticsearch.api_key: {{sourcemap_api_key}} diff --git a/apmpackage/apm/0.3.0/manifest.yml b/apmpackage/apm/0.3.0/manifest.yml index e051c922702..a9fe2a411ba 100644 --- a/apmpackage/apm/0.3.0/manifest.yml +++ b/apmpackage/apm/0.3.0/manifest.yml @@ -65,12 +65,6 @@ policy_templates: required: false show_user: true default: false - - name: kibana_api_key - type: text - title: API Key for Central Configuration - required: false - description: API Key for APM central configuration feature. Enter as : - show_user: true - name: enable_rum type: bool title: Enable RUM From 2a37a91612c5693b6e6e45d9bfcdccc4e61bac62 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Wed, 2 Jun 2021 10:06:29 +0200 Subject: [PATCH 5/5] Revert "disable kibana if running in managed mode" This reverts commit e6e2c0ee6f9d1a12a4b3b40825b5d7f83ea0a5e7. --- beater/beater.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/beater/beater.go b/beater/beater.go index 30837809947..719bd80f8db 100644 --- a/beater/beater.go +++ b/beater/beater.go @@ -308,11 +308,6 @@ func newServerRunner(ctx context.Context, args serverRunnerParams) (*serverRunne if cfg.DataStreams.Enabled && args.KibanaConfig != nil { cfg.Kibana.ClientConfig = *args.KibanaConfig } - if args.Beat.Manager != nil && args.Beat.Manager.Enabled() { - // If we're running in managed mode we do not want to - // communicate with kibana. - cfg.Kibana.Enabled = false - } runServerContext, cancel := context.WithCancel(ctx) return &serverRunner{