|
| 1 | +# `in_ebpf` Input Plugin for Fluent Bit (Experimental) |
| 2 | + |
| 3 | +> **Note:** This plugin is experimental and may be unstable. Use it in development or testing environments only, as its features and behavior are subject to change. |
| 4 | +
|
| 5 | +The `in_ebpf` input plugin is an **experimental** plugin for Fluent Bit that uses eBPF (extended Berkeley Packet Filter) to capture low-level system events. This plugin allows Fluent Bit to monitor kernel-level activities such as process executions, file accesses, memory allocations, network connections, and signal handling. It provides valuable insights into system behavior for debugging, monitoring, and security analysis. |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The `in_ebpf` plugin leverages eBPF to trace kernel events in real-time. By specifying trace points, users can collect targeted system-level metrics and events, which can be particularly useful for gaining visibility into operating system interactions and performance characteristics. |
| 10 | + |
| 11 | +## System Dependencies |
| 12 | + |
| 13 | +To enable `in_ebpf`, ensure the following dependencies are installed on your system: |
| 14 | +- **Kernel Version**: 4.18 or higher with eBPF support enabled. |
| 15 | +- **Required Packages**: |
| 16 | + - `bpftool`: Used to manage and debug eBPF programs. |
| 17 | + - `libbpf-dev`: Provides the `libbpf` library for loading and interacting with eBPF programs. |
| 18 | + - **CMake** 3.13 or higher: Required for building the plugin. |
| 19 | + |
| 20 | +### Installing Dependencies on Ubuntu |
| 21 | +```bash |
| 22 | +sudo apt update |
| 23 | +sudo apt install libbpf-dev linux-tools-common cmake |
| 24 | +``` |
| 25 | + |
| 26 | +## Building Fluent Bit with `in_ebpf` |
| 27 | + |
| 28 | +To enable the `in_ebpf` plugin, follow these steps to build Fluent Bit from source: |
| 29 | + |
| 30 | +1. **Clone the Fluent Bit Repository** |
| 31 | +```bash |
| 32 | +git clone https://github.com/fluent/fluent-bit.git |
| 33 | +cd fluent-bit |
| 34 | +``` |
| 35 | + |
| 36 | +2. **Configure the Build with `in_ebpf`** |
| 37 | + |
| 38 | +Create a build directory and run `cmake` with the `-DFLB_IN_EBPF=On` flag to enable the `in_ebpf` plugin: |
| 39 | +```bash |
| 40 | +mkdir build |
| 41 | +cd build |
| 42 | +cmake .. -DFLB_IN_EBPF=On |
| 43 | +``` |
| 44 | + |
| 45 | +3. **Compile the Source** |
| 46 | +```bash |
| 47 | +make |
| 48 | +``` |
| 49 | + |
| 50 | +4. **Run Fluent Bit** |
| 51 | + |
| 52 | +Run Fluent Bit with elevated permissions (e.g., `sudo`), as loading eBPF programs requires root access or appropriate privileges: |
| 53 | +```bash |
| 54 | +sudo ./bin/fluent-bit -c path/to/your_config.conf |
| 55 | +``` |
| 56 | + |
| 57 | +## Configuration Example |
| 58 | + |
| 59 | +Here's a basic example of how to configure the plugin: |
| 60 | + |
| 61 | +``` |
| 62 | +[INPUT] |
| 63 | + Name ebpf |
| 64 | + Trace trace_signal |
| 65 | + Trace trace_malloc |
| 66 | + Trace trace_bind |
| 67 | +``` |
| 68 | + |
| 69 | +The configuration above enables tracing for: |
| 70 | +- Signal handling events (`trace_signal`) |
| 71 | +- Memory allocation events (`trace_malloc`) |
| 72 | +- Network bind operations (`trace_bind`) |
| 73 | + |
| 74 | +You can enable multiple traces by adding multiple `Trace` directives in your configuration. |
| 75 | +Full list of existing traces can be seen here: [Fluent Bit eBPF Traces](https://github.com/fluent/fluent-bit/tree/master/plugins/in_ebpf/traces) |
| 76 | + |
0 commit comments