Skip to content

Commit

Permalink
Fix fields.yml lookup when using export template with a custom `p…
Browse files Browse the repository at this point in the history
…ath.config` param (elastic#5091)

Fixes elastic#5089
(cherry picked from commit 16ce368)
  • Loading branch information
exekias committed Sep 5, 2017
1 parent 81dafa4 commit 3548b5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Expand Up @@ -32,6 +32,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di

- Fix the `/usr/bin/beatname` script to accept `-d "*"` as a parameter. {issue}5040[5040]
- Combine `fields.yml` properties when they are defined in different sources. {issue}5075[5075]
- Fix `fields.yml` lookup when using `export template` with a custom `path.config` param. {issue}5089[5089]

*Auditbeat*

Expand Down
4 changes: 3 additions & 1 deletion libbeat/cmd/export/template.go
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"

"github.com/elastic/beats/libbeat/cmd/instance"
"github.com/elastic/beats/libbeat/paths"
"github.com/elastic/beats/libbeat/template"
)

Expand Down Expand Up @@ -44,7 +45,8 @@ func GenTemplateConfigCmd(name, beatVersion string) *cobra.Command {
os.Exit(1)
}

templateString, err := tmpl.Load(cfg.Fields)
fieldsPath := paths.Resolve(paths.Config, cfg.Fields)
templateString, err := tmpl.Load(fieldsPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error generating template: %+v", err)
os.Exit(1)
Expand Down

0 comments on commit 3548b5a

Please sign in to comment.