els0r / goProbe

High-performance IP packet metadata aggregation and efficient storage and querying of flows
GNU General Public License v2.0
12 stars 4 forks source link

Support for regex in the `query.Args.Interfaces` argument #342

Open els0r opened 3 weeks ago

els0r commented 3 weeks ago

Problem Statement

Currently, the Interfaces argument in query.Args supports

An intermediate layer is missing: the ability to arbitrarily slice the set of all interfaces in the DB. When preparing the query statement, those interfaces pertaining to a given Regex pattern are selected for query.

Examples

-i "eth[0-4]"

as the equivalent of `eth0,eth1,eth2,eth3,eth4. Or

-i "tun_4.*"

to select all IPv4 tunnels on the system (provided the interfaces are all prefixed with tun_4.

Implications for global-query

They are far-reaching. Every sensor getting a regex interface argument can decide for itself which interfaces are part of the query (just like it's done for any).

fako1024 commented 2 weeks ago

Addendum: As discussed it may also be nice to support a simple negation of interfaces (in addition to the regex logic), as in:

-i any,!eth0,!eth1

to mean any interface, but not eth0 or eth1. More complicated negation can then be done via the regex magic...