This is an old revision of the document!
Monitoraggio con ulogd2
apt install ulogd2
/etc/ulogd.conf
In the configuration file /etc/ulogd.conf we configure one plugin stack adding this line:
# Custom stack for logging connections metadata. stack=ct1:NFCT,ip2str1:IP2STR,print1:PRINTFLOW,emu1:LOGEMU
This stack definition in the ulog2 configuration file defines a pipeline of processing modules that handle network flow data. Each module in the stack performs a specific transformation or logging function. Every stack definition requires:
- One input plugin
- None, one or multiple filter plugins
- One output plugin
Each plugin module in the stack is referenced with an instance_name:module_type, where the instance_name is an arbitrary string used to identify that specific instance of the module_type. The instance_name is used also to configure the instance in the same configuration file.
Here's a breakdown of the components in the stack defined above:
- ct1:NFCT
NFCT
stands for Netfilter Connection Tracking.- This input plogin module extracts connection tracking (conntrack) information from packets, such as session state, source/destination IPs, and ports.
- ip2str1:IP2STR
IP2STR
converts IP addresses into human-readable string representations.- This ensures that logs display IP addresses in standard notation instead of numerical or binary formats.
- print1:PRINTFLOW
PRINTFLOW
formats and prints the logged packet or flow information.- This is useful for debugging or human-readable log output.
- emu1:LOGEMU
LOGEMU
refers to a custom logging output (generally referred as a logging emulator).- This is the output plugin module which is responsible for sending logs to a file, database, or another destination.
[ct1] event_mask=0x00000001 hash_enable=0
Plugin Stacks Explained
- Input plugin
- None, one or multiple filter plugins
- One output plugin
In the example above we use the NFCT input plugin, which interfaces with the nfnetlink_conntrack kernel subsystem, and provides flow-based logging.
The option hash_enable …
/etc/logrotate.d/ulogd2
systemctl enable ulogd2.service systemctl start ulogd2.service