Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Auditd: Fix Top Exec Commands dashboard visualization. {pull}27638[27638]
- Store offset in `log.offset` field of events from the filestream input. {pull}27688[27688]
- Fix `httpjson` input rate limit processing and documentation. {pull}[]
- Update Filebeat compatibility function to remove processor description field on ES < 7.9.0 {pull}27774[27774]

*Heartbeat*

Expand Down
32 changes: 31 additions & 1 deletion filebeat/fileset/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ var processorCompatibilityChecks = []processorCompatibility{
},
adaptConfig: deleteProcessor,
},
{
procType: "*",
checkVersion: func(esVersion *common.Version) bool {
return esVersion.LessThan(common.MustNewVersion("7.9.0"))
},
adaptConfig: removeDescription,
},
}

// adaptPipelineForCompatibility iterates over all processors in the pipeline
Expand All @@ -153,8 +160,14 @@ nextProcessor:
return fmt.Errorf("processor at index %d is not an object, got %T", i, obj)
}

<<<<<<< HEAD
configIfc, found := processor[proc.procType]
if !found {
=======
// Run compatibility checks on the processor.
for _, proc := range processorCompatibilityChecks {
if processor.Name() != proc.procType && proc.procType != "*" {
>>>>>>> 6e290c8156 ([Filebeat] Update compatibility function to remove processor description on ES < 7.9.0 (#27774))
continue
}
config, ok := configIfc.(map[string]interface{})
Expand All @@ -166,10 +179,14 @@ nextProcessor:
continue
}

<<<<<<< HEAD
act := proc.adaptConfig(config, log.With("processor_type", proc.procType, "processor_index", i))
obj, err = act(obj)
=======
processor, err = proc.adaptConfig(processor, log.With("processor_type", processor.Name(), "processor_index", i))
>>>>>>> 6e290c8156 ([Filebeat] Update compatibility function to remove processor description on ES < 7.9.0 (#27774))
if err != nil {
return fmt.Errorf("failed to adapt %q processor at index %d: %w", proc.procType, i, err)
return fmt.Errorf("failed to adapt %q processor at index %d: %w", processor.Name(), i, err)
}
if obj == nil {
continue nextProcessor
Expand Down Expand Up @@ -296,3 +313,16 @@ func replaceConvertIP(config map[string]interface{}, log *logp.Logger) compatAct
log.Debug("processor output=", grok)
return replaceProcessor(grok)
}

// removeDescription removes the description config option so ES less than 7.9 will work.
func removeDescription(processor Processor, log *logp.Logger) (Processor, error) {
_, ok := processor.GetString("description")
if !ok {
return processor, nil
}

log.Debug("Removing unsupported 'description' from processor.")
processor.Delete("description")

return processor, nil
}
Loading