Skip to content

Commit

Permalink
Set netflow event.created to use current timestamp (elastic#23094)
Browse files Browse the repository at this point in the history
* Update event.created to use current timestamp

* Update golden files, add changelog

Co-authored-by: Andrew Kroh <[email protected]>
  • Loading branch information
shanavas786 and andrewkroh authored Jan 14, 2021
1 parent 72eb969 commit 6986c84
Show file tree
Hide file tree
Showing 47 changed files with 9 additions and 474 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix integer overflow in S3 offsets when collecting very large files. {pull}22523[22523]
- Fix various processing errors in the Suricata module. {pull}23236[23236]
- Fix CredentialsJSON unpacking for `gcp-pubsub` and `httpjson` inputs. {pull}23277[23277]
- Change the `event.created` in Netflow events to be the time the event was created by Filebeat
to be consistent with ECS. {pull}23094[23094]

*Filebeat*

Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/netflow/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func toBeatEventCommon(flow record.Record) (event beat.Event) {

// ECS Fields -- event
ecsEvent := common.MapStr{
"created": flow.Timestamp,
"created": time.Now().UTC(),
"kind": "event",
"category": []string{"network_traffic", "network"},
"action": flow.Fields["type"],
Expand Down
8 changes: 6 additions & 2 deletions x-pack/filebeat/input/netflow/netflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ func getFlowsFromDat(t testing.TB, name string, testCase TestCase) TestResult {
}
ev := make([]beat.Event, len(flows))
for i := range flows {
ev[i] = toBeatEvent(flows[i], []string{"private"})
flow := toBeatEvent(flows[i], []string{"private"})
flow.Fields.Delete("event.created")
ev[i] = flow
}
//return TestResult{Name: name, Error: err.Error(), Events: flowsToEvents(flows)}
events = append(events, ev...)
Expand Down Expand Up @@ -242,7 +244,9 @@ func getFlowsFromPCAP(t testing.TB, name, pcapFile string) TestResult {
}
ev := make([]beat.Event, len(flows))
for i := range flows {
ev[i] = toBeatEvent(flows[i], []string{"private"})
flow := toBeatEvent(flows[i], []string{"private"})
flow.Fields.Delete("event.created")
ev[i] = flow
}
events = append(events, ev...)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"network_traffic",
"network"
],
"created": "2018-04-18T08:16:47Z",
"duration": 0,
"kind": "event",
"type": [
Expand Down Expand Up @@ -109,7 +108,6 @@
"network_traffic",
"network"
],
"created": "2018-04-18T08:16:47Z",
"duration": 0,
"kind": "event",
"type": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20269000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -97,7 +96,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20269000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -178,7 +176,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20306000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -259,7 +256,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20306000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -340,7 +336,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20317000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -421,7 +416,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20317000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -502,7 +496,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20368000000,
"kind": "event",
"type": [
Expand Down Expand Up @@ -583,7 +576,6 @@
"network_traffic",
"network"
],
"created": "2017-06-29T13:58:28Z",
"duration": 20368000000,
"kind": "event",
"type": [
Expand Down
Loading

0 comments on commit 6986c84

Please sign in to comment.