Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filebeat] Update fileset input merging to replaces paths and append processors. #16450

Merged
merged 3 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix index names for indexing not always guaranteed to be lower case. {pull}16081[16081]
- Add `ssl.ca_sha256` option to the supported TLS option, this allow to check that a specific certificate is used as part of the verified chain. {issue}15717[15717]
- Fix loading processors from annotation hints. {pull}16348[16348]
- Upgrade go-ucfg to latest v0.8.3. {pull}16450{16450}

*Auditbeat*

Expand All @@ -73,6 +74,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Prevent Elasticsearch from spewing log warnings about redundant wildcards when setting up ingest pipelines for the `elasticsearch` module. {issue}15840[15840] {pull}15900[15900]
- Fix mapping error for cloudtrail additionalEventData field {pull}16088[16088]
- Fix a connection error in httpjson input. {pull}16123[16123]
- Fix merging of fileset inputs to replace paths and append processors. {pull}16450{16450}

*Heartbeat*

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1484,8 +1484,8 @@ Apache License 2.0

--------------------------------------------------------------------
Dependency: github.com/elastic/go-ucfg
Version: v0.8.2
Revision: ab69586e10820006b250d04c98cc3b848e227808
Version: v0.8.3
Revision: f3ae3b220df32cfcae011ec6bbf87a711e6bf06b
License type (autodetected): Apache-2.0
./vendor/github.com/elastic/go-ucfg/LICENSE:
--------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion filebeat/fileset/fileset.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
"strings"
"text/template"

"github.com/elastic/go-ucfg"

errw "github.com/pkg/errors"
"gopkg.in/yaml.v2"

Expand Down Expand Up @@ -355,7 +357,7 @@ func (fs *Fileset) getInputConfig() (*common.Config, error) {
if err != nil {
return nil, fmt.Errorf("Error creating config from input overrides: %v", err)
}
cfg, err = common.MergeConfigs(cfg, overrides)
cfg, err = common.MergeConfigsWithOptions([]*common.Config{cfg, overrides}, ucfg.FieldReplaceValues("**.paths"), ucfg.FieldAppendValues("**.processors"))
if err != nil {
return nil, fmt.Errorf("Error applying config overrides: %v", err)
}
Expand Down
18 changes: 18 additions & 0 deletions libbeat/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ func MergeConfigs(cfgs ...*Config) (*Config, error) {
return config, nil
}

func MergeConfigsWithOptions(cfgs []*Config, options ...ucfg.Option) (*Config, error) {
config := NewConfig()
for _, c := range cfgs {
if err := config.MergeWithOpts(c, options...); err != nil {
return nil, err
}
}
return config, nil
}

func NewConfigWithYAML(in []byte, source string) (*Config, error) {
opts := append(
[]ucfg.Option{
Expand Down Expand Up @@ -164,6 +174,14 @@ func (c *Config) Merge(from interface{}) error {
return c.access().Merge(from, configOpts...)
}

func (c *Config) MergeWithOpts(from interface{}, opts ...ucfg.Option) error {
o := configOpts
if opts != nil {
o = append(o, opts...)
}
return c.access().Merge(from, o...)
}

func (c *Config) Unpack(to interface{}) error {
return c.access().Unpack(to, configOpts...)
}
Expand Down
8 changes: 7 additions & 1 deletion vendor/github.com/elastic/go-ucfg/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 70 additions & 2 deletions vendor/github.com/elastic/go-ucfg/merge.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions vendor/github.com/elastic/go-ucfg/opts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading