Skip to content

Commit

Permalink
Add pipeline in FB's supported hints
Browse files Browse the repository at this point in the history
Signed-off-by: chrismark <[email protected]>
  • Loading branch information
ChrsMark committed Feb 4, 2022
1 parent 2379370 commit 16d542e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions filebeat/autodiscover/builder/hints/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
excludeLines = "exclude_lines"
processors = "processors"
json = "json"
pipeline = "pipeline"
)

// validModuleNames to sanitize user input
Expand Down Expand Up @@ -121,6 +122,10 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*comm
tempCfg.Put(processors, procs)
}

if pip := l.getPipeline(h); len(pip) != 0 {
tempCfg.Put(pipeline, pip)
}

if jsonOpts := l.getJSONOptions(h); len(jsonOpts) != 0 {
tempCfg.Put(json, jsonOpts)
}
Expand Down Expand Up @@ -187,6 +192,10 @@ func (l *logHints) getProcessors(hints common.MapStr) []common.MapStr {
return builder.GetProcessors(hints, l.config.Key)
}

func (l *logHints) getPipeline(hints common.MapStr) string {
return builder.GetHintString(hints, l.config.Key, "pipeline")
}

func (l *logHints) getJSONOptions(hints common.MapStr) common.MapStr {
return builder.GetHintMapStr(hints, l.config.Key, json)
}
Expand Down
10 changes: 10 additions & 0 deletions filebeat/docs/autodiscover-hints.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ co.elastic.logs/processors.dissect.tokenizer: "%{key2} %{key1}"

In the above sample the processor definition tagged with `1` would be executed first.

[float]
===== `co.elastic.logs/pipeline`

Define an ingest pipeline ID to be added to the {beatname_uc} input/module configuration.

[source,yaml]
-----
co.elastic.logs/pipeline: custom-pipeline
-----

[float]
==== Kubernetes

Expand Down

0 comments on commit 16d542e

Please sign in to comment.