Skip to content

Commit

Permalink
Update event logger configuration via Fleet and environment variable …
Browse files Browse the repository at this point in the history
…(container command) (#4932)

* Update event logger output via Fleet

If Fleet sends an event logging output configuration different than
the one that's running, save it to the encrypted store and re-exec the
Elastic-Agent to use the new configuration.

* fix typo

* remove blank lines

* Fix typo on env var and add tests

* clean up tests

* Add changelog

* fix lint warning

* Add tests for changing the events log output via Fleet

* Improve names and code documentation

* move functions around

* Force enrol on TestEventLogOutputConfiguredViaFleet

On CI the enrol performed by TestEventLogOutputConfiguredViaFleet is
failing because there are already configuration files from
Elastic-Agent in the machine. That is probably due something left
behind from other tests.

This commit solves it by forcing enrol, which will not prompt for
confirmation and will overwrite any existing configuration.

* Fix lint issue

* Update go.mod

go mod

* Update go.sum

go mod

---------

Co-authored-by: Pierre HILBERT <[email protected]>
(cherry picked from commit 72c1ebd)

# Conflicts:
#	go.mod
#	go.sum
  • Loading branch information
belimawr authored and mergify[bot] committed Jul 10, 2024
1 parent d09ef62 commit a7a6ed4
Show file tree
Hide file tree
Showing 11 changed files with 893 additions and 251 deletions.
20 changes: 10 additions & 10 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21730,11 +21730,11 @@ THE SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/gobuffalo/here
Version: v0.6.0
Version: v0.6.7
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/gobuffalo/[email protected].0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/gobuffalo/[email protected].7/LICENSE:

The MIT License (MIT)

Expand Down Expand Up @@ -29554,11 +29554,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/karrick/godirwalk
Version: v1.16.1
Version: v1.17.0
Licence type (autodetected): BSD-2-Clause
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/karrick/godirwalk@v1.16.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/karrick/godirwalk@v1.17.0/LICENSE:

BSD 2-Clause License

Expand Down Expand Up @@ -30478,11 +30478,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

--------------------------------------------------------------------------------
Dependency : github.com/markbates/pkger
Version: v0.17.0
Version: v0.17.1
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/markbates/[email protected].0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/markbates/[email protected].1/LICENSE:

The MIT License (MIT)

Expand Down Expand Up @@ -38665,11 +38665,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : github.com/sergi/go-diff
Version: v1.2.0
Version: v1.3.1
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/sergi/go-diff@v1.2.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/sergi/go-diff@v1.3.1/LICENSE:

Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.

Expand Down Expand Up @@ -39511,11 +39511,11 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice

--------------------------------------------------------------------------------
Dependency : github.com/spf13/afero
Version: v1.9.5
Version: v1.10.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/spf13/afero@v1.9.5/LICENSE.txt:
Contents of probable licence file $GOMODCACHE/github.com/spf13/afero@v1.10.0/LICENSE.txt:

Apache License
Version 2.0, January 2004
Expand Down
32 changes: 32 additions & 0 deletions changelog/fragments/1719345278-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: feature

# Change summary; a 80ish characters long description of the change.
summary: Event logger output now can be set via Fleet overrides or environment variable for container command.

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
#description:

# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
component: elastic-agent

# PR URL; optional; the PR number that added the changeset.
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
# Please provide it if you are adding a fragment for a different PR.
pr: https://github.com/elastic/elastic-agent/pull/4932

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
#issue:
11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
github.com/gobuffalo/here v0.6.0 // indirect
github.com/gobuffalo/here v0.6.7 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down Expand Up @@ -192,7 +192,7 @@ require (
github.com/jcchavezs/porto v0.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
Expand All @@ -203,7 +203,7 @@ require (
github.com/lightstep/go-expohisto v1.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/markbates/pkger v0.17.0 // indirect
github.com/markbates/pkger v0.17.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
Expand Down Expand Up @@ -245,10 +245,15 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rs/cors v1.11.0 // indirect
<<<<<<< HEAD
github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
=======
github.com/sergi/go-diff v1.3.1 // indirect
>>>>>>> 72c1ebddf9 (Update event logger configuration via Fleet and environment variable (container command) (#4932))
github.com/shirou/gopsutil/v4 v4.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tilinna/clock v1.1.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
Expand Down
Loading

0 comments on commit a7a6ed4

Please sign in to comment.