예제 #1
0
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
}
예제 #2
0
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, ", "))
}
예제 #3
0
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
}