Commit Graph

26 Commits

Author SHA1 Message Date
Vincent Bernat
9d0574a64a inlet/flow: remove unused configuration setting queue-size for UDP 2025-10-27 23:52:55 +01:00
Vincent Bernat
98eb1bdba5 chore: make a run of gofumpt 2025-08-05 06:21:34 +02:00
Vincent Bernat
18beb310ee chore: replace interface{} with any 2025-07-29 07:42:49 +02:00
Vincent Bernat
ac68c5970e inlet: split inlet into new inlet and outlet
This change split the inlet component into a simpler inlet and a new
outlet component. The new inlet component receive flows and put them in
Kafka, unparsed. The outlet component takes them from Kafka and resume
the processing from here (flow parsing, enrichment) and puts them in
ClickHouse.

The main goal is to ensure the inlet does a minimal work to not be late
when processing packets (and restart faster). It also brings some
simplification as the number of knobs to tune everything is reduced: for
inlet, we only need to tune the queue size for UDP, the number of
workers and a few Kafka parameters; for outlet, we need to tune a few
Kafka parameters, the number of workers and a few ClickHouse parameters.

The outlet component features a simple Kafka input component. The core
component becomes just a callback function. There is also a new
ClickHouse component to push data to ClickHouse using the low-level
ch-go library with batch inserts.

This processing has an impact on the internal representation of a
FlowMessage. Previously, it was tailored to dynamically build the
protobuf message to be put in Kafka. Now, it builds the batch request to
be sent to ClickHouse. This makes the FlowMessage structure hides the
content of the next batch request and therefore, it should be reused.
This also changes the way we decode flows as they don't output
FlowMessage anymore, they reuse one that is provided to each worker.

The ClickHouse tables are slightly updated. Instead of using Kafka
engine, the Null engine is used instead.

Fix #1122
2025-07-27 21:44:28 +02:00
Vincent Bernat
84d51e0ca9 inlet/flow: use enumer for TimestampSource 2024-11-23 23:48:02 +01:00
Vincent Bernat
7977704e3a inlet/flow: run go fmt 2024-03-31 09:10:34 +02:00
netixx
c2b3cae237 Allow using fields of the netflow packet to set the flow TimeReceived
Today the timestamp can only be from kernel timetstamp put on the UDP packet
by the kernel.

I propose to add 2 alternative methods of getting the timestamp for netflow/IPFix packets:
- TimestampSourceNetflowPacket: use the timestamp field in the netflow packet itself
- TimestampSourceNetflowFirstSwitched: use the FirstSwitched field from each flow
(the field is actually in uptime, so we need to shift it according to sysUptime)

Using those fields requires the router to have accurate time (probably NTP),
but it allows for architectures where a UDP packet is not immediately
received by the collector, eg. if there is a kafka in-between.
That in turns allows to do maintenance on the collector,
without messing up the statistics
2024-03-30 22:01:40 +01:00
Vincent Bernat
895c34fa82 cmd: accept an !include tag for YAML files 2023-02-13 23:32:45 +01:00
Vincent Bernat
cdbae1c643 Revert "cmd: accept an !include tag for YAML files"
This reverts commit b8698bc060. This
change is not complete, it is missing adaptations in docker-compose.yml.
2023-02-12 14:40:56 +01:00
Vincent Bernat
b8698bc060 cmd: accept an !include tag for YAML files 2023-01-29 14:48:57 +01:00
Vincent Bernat
9884844adf cmd: switch to gopkg.in/yaml.v3 for YAML parsing 2023-01-29 13:09:22 +01:00
Vincent Bernat
c3b4116193 inlet/flow: fix parsing of per-input options
Fix #332
2022-12-19 16:51:05 +01:00
Vincent Bernat
23f7719506 inlet/flow: make UseSrcAddrForExporterAddr work for any input 2022-12-16 17:47:18 +01:00
Marvin Gaube
4050cca220 inlet/flow: allow ExporterAddress overwrite from flow source IP (#329)
* Add functionality for overwriting the exporter address with flow source ip

* Remove "agent-id-src-addr-overwrite" from default config

* Improve use-src-addr-for-exporter-addr documentation

* Rename to UseSrcAddrForExporterAddr

* Fix use-src-addr-for-exporter-addr key in example config

* Add UseSrcAddrForExporterAddr to configuration test

Co-authored-by: Marvin Gaube <marvin.gaube@exaring.de>
2022-12-16 14:57:59 +01:00
Vincent Bernat
506c15800a inlet/flow: add a per-exporter flow rate-limiter
This is useful if we cannot tune the sampling rate of the source
equipment and it is too high for us. The sampling rate is adapted.
This is difficult to test, so hopefully, this is correct!
2022-08-23 20:47:19 +02:00
Vincent Bernat
f9b507ff35 common/helpers: add a helper to test configuration decoding
For each case, we test from native map and from YAML. This should
capture all the cases we are interested.

Also, simplify pretty diff by using stringer for everything. I don't
remember why this wasn't the case. Maybe IP addresses? It's possible
to opt out by overriding formatters.
2022-08-16 21:15:23 +02:00
Vincent Bernat
334ed0f56f inlet/flow: fix input configuration parsing
Commit 3f1dc38052 introduced a regression. On an interface value,
`.String()` is not equal to `.Elem().String()`.
2022-08-16 19:43:28 +02:00
Vincent Bernat
985e678e42 chore: replace map[string]interface{} by gin.H 2022-08-16 19:43:28 +02:00
Vincent Bernat
14fcc32cd2 cmd: do not merge user-provided lists with defaults
mapstructure is not zeroing stuff to allow incremental parsing of
configuration. This is fine for most structures, but when we get a
list, we don't want to merge the list provided by the user and the
default value. In this case, we zero out the list.
2022-07-21 19:10:39 +02:00
Vincent Bernat
085d4e7946 cmd: add a registration mechanism for mapstructure hooks 2022-07-21 17:46:01 +02:00
Tchadel Icard
0d5d07dec6 inet/flow: add sflow support (#23) 2022-07-19 18:18:06 +02:00
Vincent Bernat
8be1bca4fd license: AGPL-3.0-only
```
git ls-files \*.js \*.go \
  | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n'
git ls-files \*.vue \
  | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n'
```
2022-06-29 11:42:28 +02:00
Vincent Bernat
5831754c5c build: use goimports instead of go fmt 2022-04-12 08:11:48 +02:00
Vincent Bernat
93da599adf cmd: take configuration as a mandatory argument (+ other changes)
The other changes are:
 - rename configure service to orchestrator service
 - turn DefaultConfiguration variables into functions
2022-04-10 15:14:39 +02:00
Vincent Bernat
ddee39f06c inlet/flow: by default, listen to some UDP port
The documentation said we were listening on port 2055. That was not
true. Listen to a random port since the input can be used for
something else than Netflow.
2022-04-02 11:04:21 +02:00
Vincent Bernat
1dc253764d global: split Akvorado into 3 services 2022-04-01 20:21:53 +02:00