forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix processor failure in Filebeat when using regex, contain, or equals
When using any of those conditions with the `message` field in Filebeat a warning would occur and no processor would be applied. The warning message was: WARN unexpected type *string in contains condition as it accepts only strings. This occurred because Filebeat was passing the message field as a *string (string pointer). The processor code only expected to receive string values. This PR contains three changes: - Enhance the processor code to accept *string and string. - Make filebeat pass the message field as a string rather than *string. - Modify a test case to work against the message field rather than the source field. Fixes elastic#2178
- Loading branch information
1 parent
61fd22f
commit f057ef4
Showing
5 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package processors | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestExtractString(t *testing.T) { | ||
input := "test" | ||
|
||
v, err := extractString(input) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
assert.Equal(t, input, v) | ||
|
||
v, err = extractString(&input) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
assert.Equal(t, input, v) | ||
} |