Skip to content

Commit

Permalink
Merge branch 'main' into doc-409-es
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr authored Oct 24, 2023
2 parents bb3e976 + effe78c commit 3376cd4
Show file tree
Hide file tree
Showing 19 changed files with 1,131 additions and 438 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only.
- Make Filebeat HTTPJSON input process responses sequentially. {pull}36493[36493]
- Add initial infrastructure for a caching enrichment processor. {pull}36619[36619]
- Add file-backed cache for cache enrichment processor. {pull}36686[36686] {pull}36696[36696]
- Elide retryable HTTP client construction in Filebeat HTTPJSON and CEL inputs if not needed. {pull}36916[36916]

==== Deprecated

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ is collected by it.
- Revert error introduced in {pull}35734[35734] when symlinks can't be resolved in filestream. {pull}36557[36557]
- Fix ignoring external input configuration in `take_over: true` mode {issue}36378[36378] {pull}36395[36395]
- Add validation to http_endpoint config for empty URL {pull}36816[36816] {issue}36772[36772]
- Fix merging of array fields(processors, paths, parsers) in configurations generated from hints and default config. {issue}36838[36838] {pull}36857[36857]

*Heartbeat*

Expand Down Expand Up @@ -169,6 +170,7 @@ is collected by it.
Setting environmental variable ELASTIC_NETINFO:false in Elastic Agent pod will disable the netinfo.enabled option of add_host_metadata processor
- allow `queue` configuration settings to be set under the output. {issue}35615[35615] {pull}36788[36788]
- Beats will now connect to older Elasticsearch instances by default {pull}36884[36884]
- Raise up logging level to warning when attempting to configure beats with unknown fields from autodiscovered events/environments

*Auditbeat*

Expand Down Expand Up @@ -242,6 +244,7 @@ is collected by it.
- Add cache processor. {pull}36786[36786]
- Avoid unwanted publication of Azure entity records. {pull}36753[36753]
- Avoid unwanted publication of Okta entity records. {pull}36770[36770]
- Add support for Digest Authentication to CEL input. {issue}35514[35514] {pull}36932[36932]

*Auditbeat*

Expand Down
31 changes: 31 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20004,6 +20004,37 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/icholy/digest
Version: v0.1.22
Licence type (autodetected): MIT
--------------------------------------------------------------------------------

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

MIT License

Copyright (c) 2020 Ilia Choly

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/elastic/dhcp
Version: v0.0.0-20200227161230-57ec251c7eb3
Expand Down
3 changes: 2 additions & 1 deletion filebeat/autodiscover/builder/hints/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*conf
kubernetes.ShouldPut(tempCfg, json, jsonOpts, l.log)
}
// Merge config template with the configs from the annotations
if err := config.Merge(tempCfg); err != nil {
// AppendValues option is used to append arrays from annotations to existing arrays while merging
if err := config.MergeWithOpts(tempCfg, ucfg.AppendValues); err != nil {
logp.Debug("hints.builder", "config merge failed with error: %v", err)
continue
}
Expand Down
73 changes: 73 additions & 0 deletions filebeat/autodiscover/builder/hints/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ func TestGenerateHints(t *testing.T) {
},
})

customProcessorCfg := conf.MustNewConfigFrom(map[string]interface{}{
"default_config": map[string]interface{}{
"type": "container",
"paths": []string{
"/var/lib/docker/containers/${data.container.id}/*-json.log",
},
"close_timeout": "true",
"processors": []interface{}{
map[string]interface{}{
"add_tags": map[string]interface{}{
"tags": []string{"web"},
"target": "environment",
},
},
},
},
})

defaultCfg := conf.NewConfig()

defaultDisabled := conf.MustNewConfigFrom(map[string]interface{}{
Expand Down Expand Up @@ -389,6 +407,61 @@ func TestGenerateHints(t *testing.T) {
},
},
},
{
msg: "Processors in hints must be appended in the processors of the default config",
config: customProcessorCfg,
event: bus.Event{
"host": "1.2.3.4",
"kubernetes": mapstr.M{
"container": mapstr.M{
"name": "foobar",
"id": "abc",
},
},
"container": mapstr.M{
"name": "foobar",
"id": "abc",
},
"hints": mapstr.M{
"logs": mapstr.M{
"processors": mapstr.M{
"1": mapstr.M{
"dissect": mapstr.M{
"tokenizer": "%{key1} %{key2}",
},
},
"drop_event": mapstr.M{},
},
},
},
},
len: 1,
result: []mapstr.M{
{
"type": "container",
"paths": []interface{}{
"/var/lib/docker/containers/abc/*-json.log",
},
"close_timeout": "true",
"processors": []interface{}{
map[string]interface{}{
"add_tags": map[string]interface{}{
"tags": []interface{}{"web"},
"target": "environment",
},
},
map[string]interface{}{
"dissect": map[string]interface{}{
"tokenizer": "%{key1} %{key2}",
},
},
map[string]interface{}{
"drop_event": nil,
},
},
},
},
},
{
msg: "Hint with module should attach input to its filesets",
config: customCfg,
Expand Down
7 changes: 0 additions & 7 deletions filebeat/input/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ import (
"github.com/elastic/elastic-agent-libs/logp"
)

type File struct {
File *os.File
FileInfo os.FileInfo
Path string
State *State
}

// IsSameFile checks if the given File path corresponds with the FileInfo given
// It is used to check if the file has been renamed.
func IsSameFile(path string, info os.FileInfo) bool {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ require (
github.com/googleapis/gax-go/v2 v2.11.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/icholy/digest v0.1.22
github.com/lestrrat-go/jwx/v2 v2.0.11
github.com/otiai10/copy v1.12.0
github.com/pierrec/lz4/v4 v4.1.16
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,8 @@ github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbc
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/icholy/digest v0.1.22 h1:dRIwCjtAcXch57ei+F0HSb5hmprL873+q7PoVojdMzM=
github.com/icholy/digest v0.1.22/go.mod h1:uLAeDdWKIWNFMH0wqbwchbTQOmJWhzSnL7zmqSPqEEc=
github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down
2 changes: 1 addition & 1 deletion libbeat/autodiscover/template/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func ApplyConfigTemplate(event bus.Event, configs []*conf.C, options ...ucfg.Opt
var unpacked map[string]interface{}
err = c.Unpack(&unpacked, opts...)
if err != nil {
logp.Debug("autodiscover", "Configuration template cannot be resolved: %v", err)
logp.Warn("autodiscover: Configuration template cannot be resolved: %v", err)
continue
}
// Repack again:
Expand Down
Loading

0 comments on commit 3376cd4

Please sign in to comment.