Skip to content

Commit

Permalink
incorporate feedback
Browse files Browse the repository at this point in the history
- always honor winlogbeat.overwrite_pipelines
- switch to prefix-version-short_id for pipeline ids
  • Loading branch information
leehinman committed Dec 24, 2021
1 parent be0b240 commit 383c80d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions filebeat/fileset/fileset.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ func FixYAMLMaps(elem interface{}) (_ interface{}, err error) {

// FormatPipelineID generates the ID to be used for the pipeline ID in Elasticsearch
func FormatPipelineID(prefix, module, fileset, path, version string) string {
if module == "" && fileset == "" {
return fmt.Sprintf("%s-%s-%s", prefix, version, removeExt(filepath.Base(path)))
}
return fmt.Sprintf("%s-%s-%s-%s-%s", prefix, version, module, fileset, removeExt(filepath.Base(path)))
}

Expand Down
2 changes: 1 addition & 1 deletion winlogbeat/beater/winlogbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (eb *Winlogbeat) init(b *beat.Beat) error {
eb.eventLogs = append(eb.eventLogs, logger)
}
b.OverwritePipelinesCallback = func(esConfig *common.Config) error {
overwritePipelines := true
overwritePipelines := config.OverwritePipelines
esClient, err := eslegclient.NewConnectedClient(esConfig, "Winlogbeat")
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions winlogbeat/module/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func readFile(filename string, info beat.Info) (p pipeline, err error) {
return pipeline{}, err
}
p = pipeline{
id: fileset.FormatPipelineID(info.IndexPrefix, "default", "default", filename, info.Version),
id: fileset.FormatPipelineID(info.IndexPrefix, "", "", filename, info.Version),
contents: updatedContent,
}
return p, nil
Expand Down Expand Up @@ -179,8 +179,8 @@ func applyTemplates(prefix string, version string, filename string, original []b
vars := map[string]interface{}{
"builtin": map[string]interface{}{
"prefix": prefix,
"module": "default",
"fileset": "default",
"module": "",
"fileset": "",
"beatVersion": version,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ output.elasticsearch:
#password: "changeme"

# Pipeline to route events to security, sysmon, or powershell pipelines.
pipeline: "winlogbeat-%{[agent.version]}-default-default-routing"
pipeline: "winlogbeat-%{[agent.version]}-routing"
4 changes: 2 additions & 2 deletions x-pack/winlogbeat/winlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ output.elasticsearch:
#username: "elastic"
#password: "changeme"

# Pipeline to route events to security, sysmon or powershell pipelines
pipeline: "winlogbeat-%{[agent.version]}-default-default-routing"
# Pipeline to route events to security, sysmon, or powershell pipelines.
pipeline: "winlogbeat-%{[agent.version]}-routing"

# ------------------------------ Logstash Output -------------------------------
#output.logstash:
Expand Down

0 comments on commit 383c80d

Please sign in to comment.