Skip to content

Commit

Permalink
remove license check
Browse files Browse the repository at this point in the history
- remove reference to Logstash pipelines
- cleanup grammar in godoc
- move logger creation
  • Loading branch information
leehinman committed Dec 24, 2021
1 parent 1f177e1 commit be0b240
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
3 changes: 1 addition & 2 deletions winlogbeat/beater/winlogbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ import (

const pipelinesWarning = "Winlogbeat is unable to load the ingest pipelines" +
" because the Elasticsearch output is not configured/enabled. If you have" +
" already loaded the ingest pipelines or are using Logstash pipelines, you" +
" can ignore this warning."
" already loaded the ingest pipelines, you can ignore this warning."

// Time the application was started.
var startTime = time.Now().UTC()
Expand Down
28 changes: 13 additions & 15 deletions winlogbeat/module/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,21 @@ type pipeline struct {
contents map[string]interface{}
}

// Upload reads all pipelines stored in winlogbeat executable adapts
// pipeline for a given ES version, converts to JSON if necessary and
// creates or updates ingest pipeline in ES
// Upload reads all pipelines embedded in the Winlogbeat executable
// and adapts the pipeline for a given ES version, converts to JSON if
// necessary and creates or updates ingest pipeline in ES.
func UploadPipelines(info beat.Info, esClient *eslegclient.Connection, overwritePipelines bool) error {
log := logp.NewLogger(logName)
pipelines, err := readAll(info)
if err != nil {
return err
}
return load(esClient, pipelines, overwritePipelines, log)
return load(esClient, pipelines, overwritePipelines)
}

// Export reads all pipelines stored in winlogbeat executable adapts
// pipelines for a given ES version and writes the converted pipelines
// to the given directory in JSON format
// Export reads all pipelines embedded in the Winlogbeat executable
// and adapts the pipelines for a given ES version and writes the
// converted pipelines to the given directory in JSON format.
func ExportPipelines(info beat.Info, version common.Version, directory string) error {
if !info.ElasticLicensed {
return nil
}
log := logp.NewLogger(logName)
pipelines, err := readAll(info)
if err != nil {
Expand Down Expand Up @@ -149,11 +145,13 @@ func readFile(filename string, info beat.Info) (p pipeline, err error) {
return p, nil
}

// load uses esClient to load pipelines to Elasticsearch
// cluster. Will only overwrite existing pipelines if
// overwritePipelines is true.
func load(esClient *eslegclient.Connection, pipelines []pipeline, overwritePipelines bool, log *logp.Logger) (err error) {
// load uses esClient to load pipelines to Elasticsearch cluster.
// Will only overwrite existing pipelines if overwritePipelines is
// true. An error in loading one of the pipelines will cause the
// successfully loaded ones to be deleted.
func load(esClient *eslegclient.Connection, pipelines []pipeline, overwritePipelines bool) (err error) {
var pipelineIDsLoaded []string
log := logp.NewLogger(logName)

for _, pipeline := range pipelines {
err = fileset.LoadPipeline(esClient, pipeline.id, pipeline.contents, overwritePipelines, log)
Expand Down

0 comments on commit be0b240

Please sign in to comment.