Skip to content

Commit 6a609ff

Browse files
authored
Merge pull request #151 from CESNET/bstats_enhancment
Enhancment, do not export bstats for short flows
2 parents 3515fe2 + 2fd134b commit 6a609ff

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ ipfixprobe 'pcap;file=pcaps/http.pcap' -p "phists;includezeros" -o 'unirec;i=u:h
559559

560560
List of fields exported together with basic flow fields on the interface by BSTATS plugin.
561561
The plugin is compiled to export the first `BSTATS_MAXELENCOUNT` (15 by default) burst in each direction.
562-
The bursts are computed separately for each direction. Burst is defined by `MINIMAL_PACKETS_IN_BURST` (3 by default) and by `MAXIMAL_INTERPKT_TIME` (1000 ms by default) between packets to be included in a burst.
562+
The bursts are computed separately for each direction. Burst is defined by `MINIMAL_PACKETS_IN_BURST` (3 by default) and by `MAXIMAL_INTERPKT_TIME` (1000 ms by default) between packets to be included in a burst. When the flow contains less then `MINIMAL_PACKETS_IN_BURST` packets, the fields are not exported to reduce output bandwidth.
563563

564564
| Output field | Type | Description |
565565
|:-------------------:|:-------:|:---------------------------------------------------------------:|

process/bstats.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ int BSTATSPlugin::post_update(Flow &rec, const Packet &pkt)
172172

173173
void BSTATSPlugin::pre_export(Flow &rec)
174174
{
175+
uint32_t packets = rec.src_packets + rec.dst_packets;
176+
if (packets <= MINIMAL_PACKETS_IN_BURST ) {
177+
rec.remove_extension(RecordExtBSTATS::REGISTERED_ID);
178+
return;
179+
}
180+
175181
RecordExtBSTATS *bstats_record = static_cast<RecordExtBSTATS *>(rec.get_extension(RecordExtBSTATS::REGISTERED_ID));
176182

177183
for (int direction = 0; direction < 2; direction++){

tests/functional/reference/bstats

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
::1,::1,1843,0,0,2020-11-05T21:55:29.744325,2020-11-05T21:55:38.417943,00:00:00:00:00:00,00:00:00:00:00:00,37,0,8787,41685,0,17,0,0,[],[],[17|27|23],[10|15|12],[],[],[2020-11-05T21:55:29.744325|2020-11-05T21:55:32.751840|2020-11-05T21:55:36.614423],[2020-11-05T21:55:30.900609|2020-11-05T21:55:34.771210|2020-11-05T21:55:38.417943]
2-
::1,::1,50,0,0,2020-11-05T21:54:44.884336,2020-11-05T21:54:44.884336,00:00:00:00:00:00,00:00:00:00:00:00,1,0,8787,46494,0,17,0,0,[],[],[],[],[],[],[],[]
32
::1,::1,500,0,0,2020-11-05T21:55:47.296385,2020-11-05T21:56:15.171718,00:00:00:00:00:00,00:00:00:00:00:00,10,0,8787,51295,0,17,0,0,[],[],[],[],[],[],[],[]
4-
::1,::1,52,0,0,2020-11-05T09:53:26.452501,2020-11-05T09:53:26.452501,00:00:00:00:00:00,00:00:00:00:00:00,1,0,8787,44921,0,17,0,0,[],[],[],[],[],[],[],[]
5-
::1,::1,52,0,0,2020-11-05T09:53:47.752966,2020-11-05T09:53:47.752966,00:00:00:00:00:00,00:00:00:00:00:00,1,0,8787,48477,0,17,0,0,[],[],[],[],[],[],[],[]
63
::1,::1,5315,0,0,2020-11-05T21:54:54.297688,2020-11-05T21:55:22.864093,00:00:00:00:00:00,00:00:00:00:00:00,106,0,8787,51044,0,17,0,0,[],[],[119|5|5|48|31],[66|5|5|17|12],[],[],[2020-11-05T21:54:54.297688|2020-11-05T21:55:09.164022|2020-11-05T21:55:11.252146|2020-11-05T21:55:16.320383|2020-11-05T21:55:21.155415],[2020-11-05T21:55:06.921542|2020-11-05T21:55:09.846001|2020-11-05T21:55:11.768507|2020-11-05T21:55:18.829912|2020-11-05T21:55:22.864093]
74
::1,::1,6350,0,0,2020-11-05T09:51:48.773278,2020-11-05T09:52:30.717413,00:00:00:00:00:00,00:00:00:00:00:00,126,0,8787,35762,0,17,0,0,[],[],[42|104|78],[23|56|44],[],[],[2020-11-05T09:51:48.773278|2020-11-05T09:51:57.960017|2020-11-05T09:52:21.308439],[2020-11-05T09:51:51.700710|2020-11-05T09:52:05.324445|2020-11-05T09:52:26.933943]
85
::1,::1,6580,0,0,2020-11-05T21:53:51.669102,2020-11-05T21:54:38.817994,00:00:00:00:00:00,00:00:00:00:00:00,133,0,8787,42177,0,17,0,0,[],[],[66|11|10|10|27|11|13|14|13|11],[36|6|5|6|14|10|13|14|13|11],[],[],[2020-11-05T21:53:59.015679|2020-11-05T21:54:10.744235|2020-11-05T21:54:14.061076|2020-11-05T21:54:16.650911|2020-11-05T21:54:19.360585|2020-11-05T21:54:23.540187|2020-11-05T21:54:27.457530|2020-11-05T21:54:30.935694|2020-11-05T21:54:34.324805|2020-11-05T21:54:37.564862],[2020-11-05T21:54:03.777306|2020-11-05T21:54:12.089948|2020-11-05T21:54:14.635173|2020-11-05T21:54:17.320743|2020-11-05T21:54:21.476814|2020-11-05T21:54:24.709257|2020-11-05T21:54:28.902856|2020-11-05T21:54:32.446822|2020-11-05T21:54:35.737785|2020-11-05T21:54:38.817994]
9-
::1,::1,8240,0,0,2020-11-05T09:53:08.440480,2020-11-05T09:53:08.440480,00:00:00:00:00:00,00:00:00:00:00:00,1,0,8787,55504,0,17,0,0,[],[],[],[],[],[],[],[]
10-
::1,::1,8240,0,0,2020-11-05T09:53:19.263379,2020-11-05T09:53:19.263379,00:00:00:00:00:00,00:00:00:00:00:00,1,0,8787,41246,0,17,0,0,[],[],[],[],[],[],[],[]
116
ipaddr DST_IP,ipaddr SRC_IP,uint64 BYTES,uint64 BYTES_REV,uint64 LINK_BIT_FIELD,time TIME_FIRST,time TIME_LAST,macaddr DST_MAC,macaddr SRC_MAC,uint32 PACKETS,uint32 PACKETS_REV,uint16 DST_PORT,uint16 SRC_PORT,uint8 DIR_BIT_FIELD,uint8 PROTOCOL,uint8 TCP_FLAGS,uint8 TCP_FLAGS_REV,uint32* DBI_BRST_BYTES,uint32* DBI_BRST_PACKETS,uint32* SBI_BRST_BYTES,uint32* SBI_BRST_PACKETS,time* DBI_BRST_TIME_START,time* DBI_BRST_TIME_STOP,time* SBI_BRST_TIME_START,time* SBI_BRST_TIME_STOP

0 commit comments

Comments
 (0)