Commit Graph

20 Commits

Author SHA1 Message Date
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
0239cd0a9f common: remove MarshalJSON helpers for mapstructure
They are not needed anymore since we don't exchange configuration files
using JSON, since baac495b9c.
2024-07-20 14:51:40 +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
f1f83a2ba8 common/helpers: move parametrized configuration to helpers package 2022-12-21 16:34: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
96cdb1e827 inlet/flow: make it easier to add global input options 2022-12-16 17:56:20 +01:00
Vincent Bernat
23f7719506 inlet/flow: make UseSrcAddrForExporterAddr work for any input 2022-12-16 17:47:18 +01:00
Vincent Bernat
743c98a78f cmd/config: better validation
With maps and slices, we need to explicitely use `dive` to validate
the inner structs.
2022-08-24 00:34:24 +02:00
Vincent Bernat
0dca0fc4af inlet/flow: fix validation of inlet.flow.rate-limit 2022-08-24 00:01:35 +02: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
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
086536ad03 common/helpers: rename AddMapstructureUnmarshallerHook to Register* 2022-08-14 15:08:00 +02:00
Vincent Bernat
3f1dc38052 Revert "inlet/snmp: do not deprecate default-community"
This reverts commit e5d3d3fbc3. When
adding SNMPv3, it will be odd to have this. Just put the extra mile to
deprecate it correctly.
2022-08-13 21:33:53 +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
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
1dc253764d global: split Akvorado into 3 services 2022-04-01 20:21:53 +02:00