Skip to content

Commit

Permalink
add missing import
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 committed Mar 7, 2023
1 parent 70f14b9 commit d23d628
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/filebeat/input/cel/input.go
Expand Up @@ -821,6 +821,7 @@ func newProgram(ctx context.Context, src, root string, client *http.Client, limi
lib.Collections(),
lib.Crypto(),
lib.JSON(nil),
lib.Strings(),
lib.Time(),
lib.Try(),
lib.File(mimetypes),
Expand Down
26 changes: 26 additions & 0 deletions x-pack/filebeat/input/cel/input_test.go
Expand Up @@ -294,6 +294,32 @@ int(has(state.cursor) && has(state.cursor.next) ? state.cursor.next : 0).as(inde
{"next": 3.0},
},
},
{
name: "strings_split",
config: map[string]interface{}{
"interval": 1,
"program": `
{
"events": state.data.split(":").map(s,
{
"message": s
}
)
}
`,
"state": map[string]interface{}{
"data": "first:second:third",
},
"resource": map[string]interface{}{
"url": "",
},
},
want: []map[string]interface{}{
{"message": "first"},
{"message": "second"},
{"message": "third"},
},
},

// FS-based tests.
{
Expand Down

0 comments on commit d23d628

Please sign in to comment.