Skip to content

Commit

Permalink
zeek ecs 1.7 updates for network.direction (#22967) (#23083)
Browse files Browse the repository at this point in the history
- prevent setting network.direction to external if local_orig and
  local_resp are both undefined

(cherry picked from commit f0120ce)
  • Loading branch information
leehinman authored Dec 10, 2020
1 parent 09a664d commit bec81ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix for `field [source] not present as part of path [source.ip]` error in azure pipelines. {pull}22377[22377]
- Drop aws.vpcflow.pkt_srcaddr and aws.vpcflow.pkt_dstaddr when equal to "-". {pull}22721[22721] {issue}22716[22716]
- Fix cisco umbrella module config by adding input variable. {pull}22892[22892]
- Fix network.direction logic in zeek connection fileset. {pull}22967[22967]

*Heartbeat*

Expand Down
37 changes: 24 additions & 13 deletions x-pack/filebeat/module/zeek/connection/ingest/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,30 @@ processors:
source: ctx.network.bytes = ctx.source.bytes + ctx.destination.bytes
ignore_failure: true
- script:
source: >-
if (ctx?.zeek?.connection?.local_orig == true) {
if (ctx?.zeek?.connection?.local_resp == true) {
ctx.network.direction = "internal";
} else {
ctx.network.direction = "outbound";
}
} else {
if (ctx?.zeek?.connection?.local_resp == true) {
ctx.network.direction = "inbound";
} else {
ctx.network.direction = "external";
}
source: |-
if (ctx?.zeek?.connection?.local_orig == null ||
ctx?.zeek?.connection?.local_resp == null) {
return;
}
if (ctx.zeek.connection.local_orig == true &&
ctx.zeek.connection.local_resp == true) {
ctx.network.direction = "internal";
return;
}
if (ctx.zeek.connection.local_orig == true &&
ctx.zeek.connection.local_resp == false) {
ctx.network.direction = "outbound";
return;
}
if (ctx.zeek.connection.local_orig == false &&
ctx.zeek.connection.local_resp == true) {
ctx.network.direction = "inbound";
return;
}
if (ctx.zeek.connection.local_orig == false &&
ctx.zeek.connection.local_resp == false) {
ctx.network.direction = "external";
return;
}
- geoip:
field: destination.ip
Expand Down

0 comments on commit bec81ba

Please sign in to comment.