From 33b70b36dee9ba609876c61a977d5842b756a4d2 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Wed, 19 May 2021 01:14:32 -0400 Subject: [PATCH 1/8] [Automation] Update elastic stack version to 8.0.0-cd20b01b for testing (#373) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index ef0e7d05d..2759e5930 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-bd957996-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-cd20b01b-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file From 87d694d3242773f8a55d10dc75fcad072dffe752 Mon Sep 17 00:00:00 2001 From: Sean Cunningham Date: Wed, 19 May 2021 05:45:15 -0400 Subject: [PATCH 2/8] Log version and commit at boot --- Makefile | 3 ++- cmd/fleet/main.go | 29 ++++++++++++++++++++++++----- internal/pkg/logger/logger.go | 8 -------- main.go | 3 ++- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index c177c0751..e0656f179 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ VERSION=${DEFAULT_VERSION} endif PLATFORM_TARGETS=$(addprefix release-, $(PLATFORMS)) -LDFLAGS=-w -s -X main.Version=${VERSION} +COMMIT=$(shell git rev-parse --short HEAD) +LDFLAGS=-w -s -X main.Version=${VERSION} -X main.Commit=${COMMIT} CMD_COLOR_ON=\033[32m\xE2\x9c\x93 CMD_COLOR_OFF=\033[0m diff --git a/cmd/fleet/main.go b/cmd/fleet/main.go index a2a87dae1..3c619da54 100644 --- a/cmd/fleet/main.go +++ b/cmd/fleet/main.go @@ -68,7 +68,26 @@ func makeCache(cfg *config.Config) (cache.Cache, error) { return cache.New(cacheCfg) } -func getRunCommand(version string) func(cmd *cobra.Command, args []string) error { +func initLogger(cfg *config.Config, version, commit string) (*logger.Logger, error) { + l, err := logger.Init(cfg) + if err != nil { + return nil, err + } + + log.Info(). + Str("version", version). + Str("commit", commit). + Int("pid", os.Getpid()). + Int("ppid", os.Getppid()). + Str("exe", os.Args[0]). + Strs("args", os.Args[1:]). + Msg("boot") + log.Debug().Strs("env", os.Environ()).Msg("environment") + + return l, err +} + +func getRunCommand(version, commit string) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { cfgObject := cmd.Flags().Lookup("E").Value.(*config.Flag) cliCfg := cfgObject.Config() @@ -85,7 +104,7 @@ func getRunCommand(version string) func(cmd *cobra.Command, args []string) error if err != nil { return err } - l, err = logger.Init(cfg) + l, err = initLogger(cfg, version, commit) if err != nil { return err } @@ -119,7 +138,7 @@ func getRunCommand(version string) func(cmd *cobra.Command, args []string) error return err } - l, err = logger.Init(cfg) + l, err = initLogger(cfg, version, commit) if err != nil { return err } @@ -147,11 +166,11 @@ func getRunCommand(version string) func(cmd *cobra.Command, args []string) error } } -func NewCommand(version string) *cobra.Command { +func NewCommand(version, commit string) *cobra.Command { cmd := &cobra.Command{ Use: "fleet-server", Short: "Fleet Server controls a fleet of Elastic Agents", - RunE: getRunCommand(version), + RunE: getRunCommand(version, commit), } cmd.Flags().StringP("config", "c", "fleet-server.yml", "Configuration for Fleet Server") cmd.Flags().Bool(kAgentMode, false, "Running under execution of the Elastic Agent") diff --git a/internal/pkg/logger/logger.go b/internal/pkg/logger/logger.go index 7ea38f75a..420b08a6a 100644 --- a/internal/pkg/logger/logger.go +++ b/internal/pkg/logger/logger.go @@ -88,14 +88,6 @@ func Init(cfg *config.Config) (*Logger, error) { if !cfg.Logging.Pretty || !cfg.Logging.ToStderr { zerolog.TimestampFunc = func() time.Time { return time.Now().UTC() } } - - log.Info(). - Int("pid", os.Getpid()). - Int("ppid", os.Getppid()). - Str("exe", os.Args[0]). - Strs("args", os.Args[1:]). - Msg("boot") - log.Debug().Strs("env", os.Environ()).Msg("environment") }) return gLogger, err } diff --git a/main.go b/main.go index b1aec97ea..105ac052e 100644 --- a/main.go +++ b/main.go @@ -23,10 +23,11 @@ const defaultVersion = "8.0.0" var ( Version string = defaultVersion + Commit string ) func main() { - cmd := fleet.NewCommand(Version) + cmd := fleet.NewCommand(Version, Commit) if err := cmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) From e3facdd5a9054c6355ced370a71502bf90500721 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Thu, 20 May 2021 01:15:21 -0400 Subject: [PATCH 3/8] [Automation] Update elastic stack version to 8.0.0-b5a373f0 for testing (#378) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index 2759e5930..9a58f3e3a 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-cd20b01b-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-b5a373f0-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file From ce3101876a388bda06ed896de8e143f978602f79 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Thu, 20 May 2021 11:07:01 -0400 Subject: [PATCH 4/8] Send owner: true on API call to invalid API keys. (#381) --- internal/pkg/apikey/invalidate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/pkg/apikey/invalidate.go b/internal/pkg/apikey/invalidate.go index 2e47ea6df..1a4b0abde 100644 --- a/internal/pkg/apikey/invalidate.go +++ b/internal/pkg/apikey/invalidate.go @@ -18,9 +18,11 @@ import ( func Invalidate(ctx context.Context, client *elasticsearch.Client, ids ...string) error { payload := struct { - IDs []string `json:"ids,omitempty"` + IDs []string `json:"ids,omitempty"` + Owner bool `json:"owner"` }{ ids, + true, } body, err := json.Marshal(&payload) From 9c71a0feda6ee9adb6d5cea6763dae63765a2622 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Fri, 21 May 2021 01:18:00 -0400 Subject: [PATCH 5/8] [Automation] Update elastic stack version to 8.0.0-753d8b9f for testing (#386) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index 9a58f3e3a..e0fa8048e 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-b5a373f0-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-753d8b9f-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file From 375a7717c07ceba0f673fec3bf8872cf409b5a2d Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Mon, 24 May 2021 01:16:50 -0400 Subject: [PATCH 6/8] [Automation] Update elastic stack version to 8.0.0-8c8922fb for testing (#388) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index e0fa8048e..0352fadeb 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-753d8b9f-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-8c8922fb-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file From 3bccc170be327cd13145cd05c4f50cdad73e8500 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Tue, 25 May 2021 01:17:30 -0400 Subject: [PATCH 7/8] [Automation] Update elastic stack version to 8.0.0-394043ad for testing (#393) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index 0352fadeb..d303f46d1 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-8c8922fb-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-394043ad-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file From 242e2bd4248a0cb49052c16b5575a53d06ccfcf0 Mon Sep 17 00:00:00 2001 From: apmmachine <58790750+apmmachine@users.noreply.github.com> Date: Wed, 26 May 2021 01:17:20 -0400 Subject: [PATCH 8/8] [Automation] Update elastic stack version to 8.0.0-5197c308 for testing (#396) Co-authored-by: apmmachine --- dev-tools/integration/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-tools/integration/.env b/dev-tools/integration/.env index d303f46d1..cb72652b4 100644 --- a/dev-tools/integration/.env +++ b/dev-tools/integration/.env @@ -1,4 +1,4 @@ -ELASTICSEARCH_VERSION=8.0.0-394043ad-SNAPSHOT +ELASTICSEARCH_VERSION=8.0.0-5197c308-SNAPSHOT ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=changeme TEST_ELASTICSEARCH_HOSTS=localhost:9200 \ No newline at end of file