Commit Graph

69 Commits

Author SHA1 Message Date
Vincent Bernat
abca5e983d chore: modernize some code 2025-11-14 23:22:02 +01:00
Vincent Bernat
3626bc7dcd common/schema: remove useless check when checking columns 2025-11-05 08:22:33 +01:00
Gregor Düster
73d005d229 outlet/flow: implement RFC 5103 support 2025-09-29 05:37:19 +02:00
Vincent Bernat
a1e29071a9 common/schema: add ability to reverse flow direction 2025-09-29 05:37:19 +02:00
Vincent Bernat
970fad2e47 common/schema: fix comment about ConsoleTruncateIP 2025-09-13 07:20:48 +02:00
Vincent Bernat
31b6591e0e build: update revive
And remove some unused variables.
2025-09-09 07:39:00 +02:00
Vincent Bernat
413f923dcc docker: update ClickHouse to 25.8 2025-08-30 23:46:17 +02:00
Vincent Bernat
e2f1df9add tests: replace godebug by go-cmp for structure diffs
go-cmp is stricter and allow to catch more problems. Moreover, the
output is a bit nicer.
2025-08-23 16:03:09 +02:00
Vincent Bernat
98eb1bdba5 chore: make a run of gofumpt 2025-08-05 06:21:34 +02:00
Vincent Bernat
a248997454 chore: more staticcheck fixes 2025-08-02 21:10:06 +02:00
Vincent Bernat
85226d0326 docker: create a database "test" for ClickHouse
Keep using the default one for the migration tests, but for the small
tests, use the "test" one.
2025-07-27 21:44:28 +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
fb3f5f976b common: use slices from standard library instead of x/exp/slices 2025-06-15 13:58:30 +02:00
Vincent Bernat
3ee5aea894 tests: use b.Loop() instead of range b.N for benchmarks
See https://go.dev/blog/testing-b-loop
2025-05-25 15:16:23 +02:00
Vincent Bernat
88087809dd inlet/flow: decode destination BGP communities in sFlow packets 2025-01-18 19:29:55 +01:00
Vincent Bernat
82b53b7792 common/helper: let Go deduce generic type for DefaultValuesUnmarshallerHook 2024-08-21 19:19:38 +02:00
Vincent Bernat
a449736a62 build: use Go 1.22 range over ints
Done with:

```
git grep -l 'for.*:= 0.*++' \
  | xargs sed -i -E 's/for (.*) := 0; \1 < (.*); \1\+\+/for \1 := range \2/'
```

And a few manual fixes due to unused variables. There is something fishy
in BMP rib test. Add a comment about that. This is not equivalent (as
with range, random is evaluated once, while in the original loop, it is
evaluated at each iteration). I believe the intent was to behave like
with range.
2024-08-14 10:11:35 +02:00
Paul Galceran
43c169677a Resolve L4 ports protocol names (#1257)
* fix: generation of protocols.csv file

* feat: generation of ports-tcp.csv and ports-udp.csv files

* build: add rules for creating udp and tcp csv files

* feat: create dictionary tcp and udp

* refactor: add replaceRegexpOne

* test: transform src port and dest port columns in SQL

* test: add TCP and UDP dictionaries for migration testing
2024-06-14 21:52:56 +02:00
Vincent Bernat
297e04b95c common: clickHouse → clickhouse
Let's say that we use "ClickHouse" and "clickhouse".
2024-06-09 14:59:09 +02:00
Vincent Bernat
dcdbf208d1 orchestrator/clickhouse: optimize dictionary lookup for networks 2024-03-13 20:32:20 +01:00
Francois Espinet
87a57bf82e Do geoip enrich in clickhouse instead of inlet
One solution to https://github.com/akvorado/akvorado/issues/62
2024-03-11 15:29:09 +01:00
Vincent Bernat
f321e8fa64 common/helpers: add a way to test Marshal/Unmarshal for bimaps 2024-01-22 21:53:26 +01:00
netixx
374a1fce55 Refactor to use common structs where possible 2024-01-22 20:50:13 +01:00
netixx
3188be5d23 Support providing exporter and iface metadata through metadata instead of classifiers
Sometime exporter name and interface description do not carry
all the required information for classification and metadata extraction,
supporting a way to provide the data through metadata compoenent (only static seems to make
sense at this points) enables more use-cases.
2024-01-22 20:50:13 +01:00
Vincent Bernat
cec8661387 chore: capitalize comments 2024-01-22 20:34:08 +01:00
Vincent Bernat
0fedcf831e inlet/core: add back protobuf export of flows 2023-11-28 21:16:42 +01:00
Vincent Bernat
4a7a779237 common/schema: add MPLS4thLabel
MPLS labels often go by pair. It makes sense to access the 4th one easily.
2023-11-28 19:47:03 +01:00
Vincent Bernat
82051b552f inlet: decode MPLS labels
They are stored in an array and there are some aliases to get 1st, 2nd
and third label. Support for sFlow would need a test to ensure it works
as expected.

Fix #960
2023-11-25 20:34:45 +01:00
Vincent Bernat
e9d1431a2c common/schema: remove ability to use IPv4 in custom dict
People should use IPv6. All the existing code is handling IPv6.
2023-09-23 19:11:20 +02:00
Vincent Bernat
6dc0b512c6 console/filter: add filtering support for custom columns
Some of the code is based on #870.
2023-09-16 17:19:12 +02:00
Marvin Gaube
5efa368e79 feat: add option for materialized types & improve filter performance for materialized Prefixes 2023-09-08 20:54:27 +02:00
Vincent Bernat
d1cef41849 common/schema: don't store number of dynamic columns as state
Instead, we compute the maximum value for `Key` among the current set of columns.
2023-08-25 22:20:52 +02:00
Marvin Gaube
e6effd1335 feat: add custom dictionaries for additional, customized flow hydration 2023-08-25 22:10:30 +02:00
Vincent Bernat
bebfa28b5d common/schema: use LowCardinality for NextHop
It should be about an order higher than the number of exporters. For
example, if you get ~10 peers per exporters and 100 exporters, you get
1000 possible nexthops.

Also, make it disabled by default. Most new types should be opt-in as it
means more space on database.
2023-08-25 21:59:53 +02:00
Marvin Gaube
fa0ac2388a feat: expose nexthop as dimension 2023-08-25 21:57:26 +02:00
Vincent Bernat
0e1b5a3351 common/schema: introduce ICMPv4/ICMPv6 virtual columns 2023-06-03 18:57:19 +02:00
Vincent Bernat
5067072c12 common/schema: use separate fields for ICMP v4 and ICMP v6
They have different values. Use ICMPv4 and not ICMP, because it is IPv4
specific (all fields hold this convention currently, good).
2023-05-31 09:18:03 +02:00
Vincent Bernat
9ce245d236 common/schema: add TTL, fragments, ToS, TCP flags and ICMP type/code
Remaining tasks:

- [ ] use a dictionary for ICMP type/code and add completion
- [ ] add tests for ICMP (sFlow and Netflow)
- [ ] handle binary operators for TCP flags (optional, lot of work)

Fix #729
2023-05-31 09:08:16 +02:00
Marvin Gaube
d887f35647 feat: redesign net mask handling, also allow using net masks from BMP 2023-05-08 08:12:48 +02:00
Vincent Bernat
23b453f573 common/schema: rename generate to materialized
See #588
2023-03-30 22:47:12 +02:00
Marvin Gaube
00026beabd common/schema: make alias/generate configureable 2023-03-27 15:16:45 +02:00
Vincent Bernat
1ec89aac1f build: fix various lint issues
revive default configuration has changed in 1.3.0. Some stuff is a bit
silly (like empty blocks), but I find it easier to follow that than to
try to tweak the configuration.
2023-03-21 00:01:13 +01:00
Vincent Bernat
63267f0f5b console: enable SrcAddr/DstAddr truncation to a fixed length 2023-02-22 20:55:21 +01:00
Vincent Bernat
3ea9814214 common/schema: fix validation of NotMainTableOnly option
Fix #454
2023-02-14 15:27:51 +01:00
Vincent Bernat
c8c00b1448 inlet/core: add Interface.VLAN to interface classifier
Fix #318
Fix #384
2023-02-14 15:03:40 +01:00
Vincent Bernat
a912da7fa1 build: use gofumpt
Undecided if we need to use it. I think it's nice.
2023-02-11 10:03:45 +01:00
Vincent Bernat
e51d45ef2b common/schema: make ProtobufDecode() an helper function 2023-02-06 22:56:54 +01:00
Vincent Bernat
930c2daa4c common/schema: reduce storage for Src/DstAddr, Bytes, Packets
Also teach orchestrator to change compression codecs.
2023-02-06 22:56:54 +01:00
Vincent Bernat
65e3e1783a common/schema: check for dependencies between columns 2023-01-30 06:48:16 +01:00
Vincent Bernat
51988449d2 common/schema: fix GenerateFrom for DstNet* 2023-01-27 22:49:17 +01:00