Skip to content

Commit

Permalink
[8.15](backport #41099) [aws] Change log.file.path field in awscloudw…
Browse files Browse the repository at this point in the history
…atch input to nested object (#41163)

* [aws] Change log.file.path field in awscloudwatch input to nested object (#41099)

Change log.file.path field in awscloudwatch input to nested object

(cherry picked from commit 904d14b)

---------

Co-authored-by: kaiyan-sheng <[email protected]>
  • Loading branch information
mergify[bot] and kaiyan-sheng authored Oct 8, 2024
1 parent 7e45173 commit 2a714a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Removed deprecated Cylance from Beats. See <<migrate-from-deprecated-module>> for migration options. {pull}38037[38037]
- Removed deprecated Bluecoat from Beats. See <<migrate-from-deprecated-module>> for migration options. {pull}38037[38037]
- Introduce input/netmetrics and refactor netflow input metrics {pull}38055[38055]
- Change log.file.path field in awscloudwatch input to nested object. {pull}41099[41099]

*Heartbeat*

Expand Down
6 changes: 5 additions & 1 deletion x-pack/filebeat/input/awscloudwatch/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func TestCreateEvent(t *testing.T) {
"event": mapstr.M{
"id": *logEvent.EventId,
},
"log.file.path": "logGroup1" + "/" + *logEvent.LogStreamName,
"log": mapstr.M{
"file": mapstr.M{
"path": "logGroup1" + "/" + *logEvent.LogStreamName,
},
},
"awscloudwatch": mapstr.M{
"log_group": "logGroup1",
"log_stream": *logEvent.LogStreamName,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/filebeat/input/awscloudwatch/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ func createEvent(logEvent types.FilteredLogEvent, logGroup string, regionName st
event := beat.Event{
Timestamp: time.Unix(*logEvent.Timestamp/1000, 0).UTC(),
Fields: mapstr.M{
"message": *logEvent.Message,
"log.file.path": logGroup + "/" + *logEvent.LogStreamName,
"message": *logEvent.Message,
"log": mapstr.M{
"file": mapstr.M{
"path": logGroup + "/" + *logEvent.LogStreamName,
},
},
"event": mapstr.M{
"id": *logEvent.EventId,
"ingested": time.Now(),
Expand Down

0 comments on commit 2a714a1

Please sign in to comment.