Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conntrack: Remove old implementation #294

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,6 @@ parameters:
output: match-10.0
type: add_regex_if
parameters: 10.0.*
- input: "{{.srcIP}},{{.srcPort}},{{.dstIP}},{{.dstPort}},{{.protocol}}"
output: isNewFlow
type: conn_tracking
parameters: "1"
```

The first rule `add_subnet` generates a new field named `srcSubnet` with the
Copy link
Collaborator

@KalmanMeth KalmanMeth Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be a new section on describing the connection tracking parameters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I documented the new connection tracking in #291

Expand Down Expand Up @@ -460,10 +456,6 @@ the contents of the `srcSubnet` field for entries that match regex expression sp
in the `parameters` variable. In addition, the field `match-10.0_Matched` with
value `true` is added to all matched entries

The seventh rule `conn_tracking` generates a new field named `isNewFlow` that contains
the contents of the `parameters` variable **only for new entries** (first seen in 120 seconds)
that match hash of template fields from the `input` variable.


> Note: above example describes all available transform network `Type` options

Expand Down
2 changes: 1 addition & 1 deletion contrib/dashboards/dashboard_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
"steppedLine": false,
"targets": [
{
"expr": "topk(10,rate(flp_connections_per_destination_subnet[1m]))",
"expr": "topk(10,rate(flp_connections_per_destination_subnet{_RecordType=\"newConnection\"}[1m]))",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
Expand Down
2 changes: 1 addition & 1 deletion contrib/dashboards/jsonnet/dashboard_details.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dashboard.new(
)
.addTarget(
prometheus.target(
expr='topk(10,rate(flp_connections_per_destination_subnet[1m]))',
expr='topk(10,rate(flp_connections_per_destination_subnet{_RecordType="newConnection"}[1m]))',
)
), gridPos={
x: 0,
Expand Down
11 changes: 4 additions & 7 deletions contrib/kubernetes/flowlogs-pipeline.conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ parameters:
output: srcSubnet
type: add_subnet
parameters: /16
- input: '{{.srcIP}},{{.srcPort}},{{.dstIP}},{{.dstPort}},{{.proto}}'
output: isNewFlow
type: conn_tracking
parameters: "1"
- input: dstIP
output: dstSubnet
type: add_subnet
Expand All @@ -100,10 +96,12 @@ parameters:
fields:
- srcIP
- srcPort
- srcSubnet
- name: dst
fields:
- dstIP
- dstPort
- dstSubnet
- name: protocol
fields:
- proto
Expand Down Expand Up @@ -181,7 +179,6 @@ parameters:
- dstSubnet
- _RecordType
operation: count
recordKey: isNewFlow
- name: src_connection_count
by:
- srcSubnet
Expand Down Expand Up @@ -324,8 +321,8 @@ parameters:
value: dest_connection_subnet_count
valueKey: recent_count
labels:
- by
- aggregate
- _RecordType
- dstSubnet
buckets: []
- name: connections_per_source_subnet
type: counter
Expand Down
1 change: 0 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ Following is the supported API format for network transformations:
input: entry input field
output: entry output field
type: (enum) one of the following:
conn_tracking: set output field to value of parameters field only for new flows by matching template in input field
add_regex_if: add output field if input field satisfies regex pattern from parameters field
add_if: add output field if input field satisfies criteria from parameters field
add_subnet: add output subnet field from input field and prefix length from parameters field
Expand Down
4 changes: 2 additions & 2 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ and the transformation to generate the exported metric.
### connection rate per dest subnet
| **Description** | This metric observes network connections rate per destination subnet |
|:---|:---|
| **Details** | Counts the number of connections per subnet with network prefix length /16 (using conn_tracking sum isNewFlow field) |
| **Details** | Counts the number of connections per subnet with network prefix length /16 |
| **Usage** | Evaluate network connections per subnet |
| **Tags** | rate, subnet |
| **Operation** | aggregate by `dstSubnet, _RecordType` and `count` field `isNewFlow` |
| **Operation** | aggregate by `dstSubnet, _RecordType` and `count` |
| **Exposed as** | `flp_connections_per_destination_subnet` of type `counter` |
| **Visualized as** | "Connections rate per destinationIP /16 subnets" on dashboard `details` |
|||
Expand Down
2 changes: 2 additions & 0 deletions network_definitions/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ extract:
fields:
- srcIP
- srcPort
- srcSubnet
- name: dst
fields:
- dstIP
- dstPort
- dstSubnet
- name: protocol
fields:
- proto
Expand Down
13 changes: 4 additions & 9 deletions network_definitions/connection_rate_per_dest_subnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
description:
This metric observes network connections rate per destination subnet
details:
Counts the number of connections per subnet with network prefix length /16 (using conn_tracking sum isNewFlow field)
Counts the number of connections per subnet with network prefix length /16
usage:
Evaluate network connections per subnet
tags:
- rate
- subnet
transform:
rules:
- input: "{{.srcIP}},{{.srcPort}},{{.dstIP}},{{.dstPort}},{{.proto}}"
output: isNewFlow
type: conn_tracking
parameters: "1"
- input: dstIP
output: dstSubnet
type: add_subnet
Expand All @@ -26,7 +22,6 @@ extract:
- dstSubnet
- _RecordType
operation: count
recordKey: isNewFlow
encode:
type: prom
prom:
Expand All @@ -36,12 +31,12 @@ encode:
filter: {key: name, value: dest_connection_subnet_count}
valueKey: recent_count
labels:
- by
- aggregate
- _RecordType
- dstSubnet
visualization:
type: grafana
grafana:
- expr: 'topk(10,rate(flp_connections_per_destination_subnet[1m]))'
- expr: 'topk(10,rate(flp_connections_per_destination_subnet{_RecordType="newConnection"}[1m]))'
type: graphPanel
dashboard: details
title:
Expand Down
1 change: 0 additions & 1 deletion pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const (
FilterType = "filter"
ConnTrackType = "conntrack"
NoneType = "none"
ConnTrackingRuleType = "conn_tracking"
AddRegExIfRuleType = "add_regex_if"
AddIfRuleType = "add_if"
AddSubnetRuleType = "add_subnet"
Expand Down
1 change: 0 additions & 1 deletion pkg/api/transform_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type TransformNetwork struct {
}

type TransformNetworkOperationEnum struct {
ConnTracking string `yaml:"conn_tracking" json:"conn_tracking" doc:"set output field to value of parameters field only for new flows by matching template in input field"`
AddRegExIf string `yaml:"add_regex_if" json:"add_regex_if" doc:"add output field if input field satisfies regex pattern from parameters field"`
AddIf string `yaml:"add_if" json:"add_if" doc:"add output field if input field satisfies criteria from parameters field"`
AddSubnet string `yaml:"add_subnet" json:"add_subnet" doc:"add output subnet field from input field and prefix length from parameters field"`
Expand Down
89 changes: 0 additions & 89 deletions pkg/pipeline/transform/connection_tracking/connection_tracking.go

This file was deleted.

This file was deleted.

Loading