Skip to content

Commit

Permalink
Change to final pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Wurm committed Feb 6, 2020
1 parent 60f51bc commit 9ad7b8a
Show file tree
Hide file tree
Showing 41 changed files with 208 additions and 282 deletions.
16 changes: 8 additions & 8 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,17 +1066,17 @@ setup.template.settings:
#_source:
#enabled: false

# Set to false to disable using a default pipeline.
#setup.template.default_pipeline.enabled: true
# Set to false to disable using a final pipeline.
#setup.template.final_pipeline.enabled: true

# Overwrite any existing default pipeline.
#setup.template.default_pipeline.overwrite: false
# Overwrite any existing final pipeline.
#setup.template.final_pipeline.overwrite: false

# Specify a custom name for the default pipeline.
#setup.template.default_pipeline.name: "%{[agent.name]}-%{[agent.version]}"
# Specify a custom name for the final pipeline.
#setup.template.final_pipeline.name: "%{[agent.name]}-%{[agent.version]}"

# Load a custom default pipeline from a file.
#setup.template.default_pipeline.file:
# Load a custom final pipeline from a file.
#setup.template.final_pipeline.file:

#============================== Setup ILM =====================================

Expand Down
9 changes: 0 additions & 9 deletions auditbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2510,15 +2510,6 @@ type: keyword
--
*`event.ingested`*::
+
--
Ingest timestamp
type: date
--
[[exported-fields-cloud]]
== Cloud provider metadata fields
Expand Down
2 changes: 1 addition & 1 deletion auditbeat/include/fields.go

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions filebeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3044,15 +3044,6 @@ type: keyword
--
*`event.ingested`*::
+
--
Ingest timestamp
type: date
--
[[exported-fields-cef]]
== Decode CEF processor fields fields
Expand Down
16 changes: 8 additions & 8 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1763,17 +1763,17 @@ setup.template.settings:
#_source:
#enabled: false

# Set to false to disable using a default pipeline.
#setup.template.default_pipeline.enabled: true
# Set to false to disable using a final pipeline.
#setup.template.final_pipeline.enabled: true

# Overwrite any existing default pipeline.
#setup.template.default_pipeline.overwrite: false
# Overwrite any existing final pipeline.
#setup.template.final_pipeline.overwrite: false

# Specify a custom name for the default pipeline.
#setup.template.default_pipeline.name: "%{[agent.name]}-%{[agent.version]}"
# Specify a custom name for the final pipeline.
#setup.template.final_pipeline.name: "%{[agent.name]}-%{[agent.version]}"

# Load a custom default pipeline from a file.
#setup.template.default_pipeline.file:
# Load a custom final pipeline from a file.
#setup.template.final_pipeline.file:

#============================== Setup ILM =====================================

Expand Down
2 changes: 1 addition & 1 deletion filebeat/include/fields.go

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions heartbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ type: keyword
--
*`event.ingested`*::
+
--
Ingest timestamp
type: date
--
[[exported-fields-cloud]]
== Cloud provider metadata fields
Expand Down
16 changes: 8 additions & 8 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1210,17 +1210,17 @@ setup.template.settings:
#_source:
#enabled: false

# Set to false to disable using a default pipeline.
#setup.template.default_pipeline.enabled: true
# Set to false to disable using a final pipeline.
#setup.template.final_pipeline.enabled: true

# Overwrite any existing default pipeline.
#setup.template.default_pipeline.overwrite: false
# Overwrite any existing final pipeline.
#setup.template.final_pipeline.overwrite: false

# Specify a custom name for the default pipeline.
#setup.template.default_pipeline.name: "%{[agent.name]}-%{[agent.version]}"
# Specify a custom name for the final pipeline.
#setup.template.final_pipeline.name: "%{[agent.name]}-%{[agent.version]}"

# Load a custom default pipeline from a file.
#setup.template.default_pipeline.file:
# Load a custom final pipeline from a file.
#setup.template.final_pipeline.file:

#============================== Setup ILM =====================================

Expand Down
2 changes: 1 addition & 1 deletion heartbeat/include/fields.go

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions journalbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ type: keyword
--
*`event.ingested`*::
+
--
Ingest timestamp
type: date
--
[[exported-fields-cloud]]
== Cloud provider metadata fields
Expand Down
2 changes: 1 addition & 1 deletion journalbeat/include/fields.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions journalbeat/journalbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1004,17 +1004,17 @@ setup.template.settings:
#_source:
#enabled: false

# Set to false to disable using a default pipeline.
#setup.template.default_pipeline.enabled: true
# Set to false to disable using a final pipeline.
#setup.template.final_pipeline.enabled: true

# Overwrite any existing default pipeline.
#setup.template.default_pipeline.overwrite: false
# Overwrite any existing final pipeline.
#setup.template.final_pipeline.overwrite: false

# Specify a custom name for the default pipeline.
#setup.template.default_pipeline.name: "%{[agent.name]}-%{[agent.version]}"
# Specify a custom name for the final pipeline.
#setup.template.final_pipeline.name: "%{[agent.name]}-%{[agent.version]}"

# Load a custom default pipeline from a file.
#setup.template.default_pipeline.file:
# Load a custom final pipeline from a file.
#setup.template.final_pipeline.file:

#============================== Setup ILM =====================================

Expand Down
16 changes: 8 additions & 8 deletions libbeat/_meta/config.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -947,17 +947,17 @@ setup.template.settings:
#_source:
#enabled: false

# Set to false to disable using a default pipeline.
#setup.template.default_pipeline.enabled: true
# Set to false to disable using a final pipeline.
#setup.template.final_pipeline.enabled: true

# Overwrite any existing default pipeline.
#setup.template.default_pipeline.overwrite: false
# Overwrite any existing final pipeline.
#setup.template.final_pipeline.overwrite: false

# Specify a custom name for the default pipeline.
#setup.template.default_pipeline.name: "%{[agent.name]}-%{[agent.version]}"
# Specify a custom name for the final pipeline.
#setup.template.final_pipeline.name: "%{[agent.name]}-%{[agent.version]}"

# Load a custom default pipeline from a file.
#setup.template.default_pipeline.file:
# Load a custom final pipeline from a file.
#setup.template.final_pipeline.file:

#============================== Setup ILM =====================================

Expand Down
4 changes: 0 additions & 4 deletions libbeat/_meta/fields.common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@
- name: timeseries.instance
type: keyword
description: Time series instance id

- name: event.ingested
type: date
description: Ingest timestamp
2 changes: 1 addition & 1 deletion libbeat/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func genExportCmd(settings instance.Settings) *cobra.Command {
exportCmd.AddCommand(export.GenIndexPatternConfigCmd(settings))
exportCmd.AddCommand(export.GenDashboardCmd(settings))
exportCmd.AddCommand(export.GenGetILMPolicyCmd(settings))
exportCmd.AddCommand(export.GenExportDefaultPipelineCmd(settings))
exportCmd.AddCommand(export.GenExportFinalPipelineCmd(settings))

return exportCmd
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"github.com/elastic/beats/libbeat/idxmgmt"
)

// GenExportDefaultPipelineCmd writes out the default ingest pipeline.
func GenExportDefaultPipelineCmd(settings instance.Settings) *cobra.Command {
// GenExportFinalPipelineCmd writes out the final ingest pipeline.
func GenExportFinalPipelineCmd(settings instance.Settings) *cobra.Command {
genTemplateConfigCmd := &cobra.Command{
Use: "default-pipeline",
Short: "Export Elasticsearch default ingest pipeline to stdout",
Use: "final-pipeline",
Short: "Export Elasticsearch final ingest pipeline to stdout",
Run: func(cmd *cobra.Command, args []string) {
version, _ := cmd.Flags().GetString("es.version")
dir, _ := cmd.Flags().GetString("dir")
Expand All @@ -41,7 +41,7 @@ func GenExportDefaultPipelineCmd(settings instance.Settings) *cobra.Command {
clientHandler := idxmgmt.NewFileClientHandler(newIdxmgmtClient(dir, version))
idxManager := b.IdxSupporter.Manager(clientHandler, idxmgmt.BeatsAssets(b.Fields))
if err := idxManager.Setup(idxmgmt.LoadModeDisabled, idxmgmt.LoadModeDisabled, idxmgmt.LoadModeForce); err != nil {
fatalf("Error exporting default-pipeline: %+v.", err)
fatalf("Error exporting final-pipeline: %+v.", err)
}
},
}
Expand Down
6 changes: 3 additions & 3 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,22 +501,22 @@ func (b *Beat) Setup(settings Settings, bt beat.Creator, setup SetupSettings) er
return err
}

var loadTemplate, loadILM, loadDefaultPipeline = idxmgmt.LoadModeUnset, idxmgmt.LoadModeUnset, idxmgmt.LoadModeUnset
var loadTemplate, loadILM, loadFinalPipeline = idxmgmt.LoadModeUnset, idxmgmt.LoadModeUnset, idxmgmt.LoadModeUnset
if setup.IndexManagement || setup.Template {
loadTemplate = idxmgmt.LoadModeOverwrite
}
if setup.IndexManagement || setup.ILMPolicy {
loadILM = idxmgmt.LoadModeEnabled
}
if setup.IndexManagement {
loadDefaultPipeline = idxmgmt.LoadModeOverwrite
loadFinalPipeline = idxmgmt.LoadModeOverwrite
}

m := b.IdxSupporter.Manager(idxmgmt.NewESClientHandler(esClient), idxmgmt.BeatsAssets(b.Fields))
if ok, warn := m.VerifySetup(loadTemplate, loadILM); !ok {
fmt.Println(warn)
}
if err = m.Setup(loadTemplate, loadILM, loadDefaultPipeline); err != nil {
if err = m.Setup(loadTemplate, loadILM, loadFinalPipeline); err != nil {
return err
}
fmt.Println("Index setup finished.")
Expand Down
22 changes: 11 additions & 11 deletions libbeat/docs/template-config.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ setup.template.settings:

*`setup.template.append_fields`* experimental[]:: A list of fields to be added
to the template and {kib} index pattern. This setting adds new fields. It does
not overwrite or change existing fields.
not overwrite or change existing fields.
+
This setting is useful when your data contains fields that {beatname_uc} doesn't
know about in advance.
know about in advance.
ifeval::["{beatname_lc}"=="metricbeat"]
For example, you might want to append fields to the template when you're using
a metricset, such as the <<metricbeat-metricset-http-json>>, and the full data
structure is not known in advance.
structure is not known in advance.
endif::[]
+
If `append_fields` is specified along with `overwrite: true`, {beatname_uc}
Expand All @@ -117,7 +117,7 @@ setup.template.append_fields:

*`setup.template.json.enabled`*:: Set to `true` to load a
JSON-based template file. Specify the path to your {es} index template file and
set the name of the template.
set the name of the template.
+
["source","yaml",subs="attributes"]
----------------------------------------------------------------------
Expand All @@ -129,16 +129,16 @@ setup.template.json.name: "template-name
NOTE: If the JSON template is used, the `fields.yml` is skipped for the template
generation.

*`setup.template.default_pipeline.enabled`*:: Set to `false` to disable loading of the
default ingest pipeline.
*`setup.template.final_pipeline.enabled`*:: Set to `false` to disable loading of the
final ingest pipeline.

*`setup.template.default_pipeline.overwrite`*:: A boolean that specifies whether to overwrite
the existing pipeline (if any). The default is `false`.
*`setup.template.final_pipeline.overwrite`*:: A boolean that specifies whether to overwrite
the existing pipeline (if any). The final is `false`.

*`setup.template.default_pipeline.name`*:: Specify a custom name for the default pipeline.
Defaults to `beats_default`.
*`setup.template.final_pipeline.name`*:: Specify a custom name for the final pipeline.
Defaults to `beats_final`.

*`setup.template.default_pipeline.file`*:: Load a custom default pipeline from a file instead
*`setup.template.final_pipeline.file`*:: Load a custom final pipeline from a file instead
of the built-in one. Files can be in either JSON or YAML format and must have
`.json`, `.yaml`, or `.yml` as their extension.

2 changes: 1 addition & 1 deletion libbeat/idxmgmt/idxmgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type Manager interface {
VerifySetup(template, ilm LoadMode) (bool, string)
// When supporting index lifecycle management, ensure templates and policies
// are created before write aliases, to ensure templates are applied to the indices.
Setup(template, ilm, defaultPipeline LoadMode) error
Setup(template, ilm, finalPipeline LoadMode) error
}

// LoadMode defines the mode to be used for loading idxmgmt related information.
Expand Down
22 changes: 11 additions & 11 deletions libbeat/idxmgmt/std.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ type componentType uint8

//go:generate stringer -linecomment -type componentType
const (
componentTemplate componentType = iota //template
componentILM //ilm
componentDefaultPipeline //default_pipeline
componentTemplate componentType = iota //template
componentILM //ilm
componentFinalPipeline //final_pipeline
)

type feature struct {
Expand Down Expand Up @@ -136,8 +136,8 @@ func (s *indexSupport) enabled(c componentType) bool {
return s.templateCfg.Enabled
case componentILM:
return s.ilm.Mode() != ilm.ModeDisabled
case componentDefaultPipeline:
return s.templateCfg.DefaultPipeline.Enabled
case componentFinalPipeline:
return s.templateCfg.FinalPipeline.Enabled
}
return false
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (m *indexManager) VerifySetup(loadTemplate, loadILM LoadMode) (bool, string
}

//
func (m *indexManager) Setup(loadTemplate, loadILM, loadDefaultPipeline LoadMode) error {
func (m *indexManager) Setup(loadTemplate, loadILM, loadFinalPipeline LoadMode) error {
log := m.support.log

withILM, err := m.setupWithILM()
Expand All @@ -264,8 +264,8 @@ func (m *indexManager) Setup(loadTemplate, loadILM, loadDefaultPipeline LoadMode
ilmComponent := newFeature(componentILM, withILM, m.support.ilm.Overwrite(), loadILM)
templateComponent := newFeature(componentTemplate, m.support.enabled(componentTemplate),
m.support.templateCfg.Overwrite, loadTemplate)
defaultPipelineComponent := newFeature(componentDefaultPipeline, m.support.enabled(componentDefaultPipeline),
false, loadDefaultPipeline)
finalPipelineComponent := newFeature(componentFinalPipeline, m.support.enabled(componentFinalPipeline),
false, loadFinalPipeline)

if ilmComponent.load {
// install ilm policy
Expand All @@ -281,10 +281,10 @@ func (m *indexManager) Setup(loadTemplate, loadILM, loadDefaultPipeline LoadMode
}
}

if defaultPipelineComponent.load {
err = m.clientHandler.LoadDefaultPipeline(m.support.templateCfg, m.support.info)
if finalPipelineComponent.load {
err = m.clientHandler.LoadFinalPipeline(m.support.templateCfg, m.support.info)
if err != nil {
return fmt.Errorf("error loading default pipeline: %v", err)
return fmt.Errorf("error loading final pipeline: %v", err)
}
}

Expand Down
Loading

0 comments on commit 9ad7b8a

Please sign in to comment.