func (f dropFields) Run(event common.MapStr) (common.MapStr, error) { for _, field := range f.Fields { err := event.Delete(field) if err != nil { return event, fmt.Errorf("Fail to delete key %s: %s", field, err) } } return event, nil }
func (f dropFields) Run(event common.MapStr) (common.MapStr, error) { errors := []string{} for _, field := range f.Fields { err := event.Delete(field) if err != nil { errors = append(errors, err.Error()) } } return event, fmt.Errorf(strings.Join(errors, ", ")) }
func (f *DropFields) Filter(event common.MapStr) (common.MapStr, error) { if f.Cond != nil && !f.Cond.Check(event) { return event, nil } for _, field := range f.Fields { err := event.Delete(field) if err != nil { return event, fmt.Errorf("Fail to delete key %s: %s", field, err) } } return event, nil }