Skip to main content
Version: v4.22

community_id

Computes the Community ID for a given network flow.

community_id(src_ip=ip, dst_ip=ip, proto=str, [src_port=int, dst_port=int, seed=int]) -> str

Description

The src_ip and dst_ip parameters are required. The proto string is also required and must be tcp, udp, icmp or icmp6. src_port and dst_port may only be specified if the other one is. seed can be used to set the initial hashing seed.

Examples

from {
  source_ip: 1.2.3.4,
  source_port: 4584,
  destination_ip: 43.3.132.3,
  destination_port: 3483,
  protocol: "tcp",
}
cid = community_id(
  src_ip=source_ip,
  src_port=source_port,
  dst_ip=destination_ip,
  dst_port=destination_port,
  proto=protocol,
)
// cid == "1:koNcqhFRD5kb254ZrLsdv630jCM="
from {
  source_ip: 1.2.3.4,
  destination_ip: 43.3.132.3,
}
cid = community_id(src_ip=source_ip, dst_ip=destination_ip, proto="udp")
// cid == "1:7TrrMeH98PrUKC0ySu3RNmpUr48="