Context: I am completely new to rust. Trying to port an existing BCC eBPF implementation to aya.
Disclosure: Heavily using AI agents to code this with limited understanding.
Summary
There is no way to log a process name (comm) from a BPF program using aya-log-ebpf. This is one of the most common things you want to include in a BPF log line — "which process triggered this event?" — and currently there's no supported path to do it.
Background
bpf_get_current_comm() is a standard BPF helper that returns the current process name as a [u8; 16] null-terminated byte array. It is the BPF equivalent of reading /proc/<pid>/comm. Nearly every BPF observability tool logs this.
In aya, the natural thing to write is:
use aya_ebpf::helpers::bpf_get_current_comm;
use aya_log_ebpf::info;
let comm = bpf_get_current_comm().unwrap_or([0u8; 16]);
info!(ctx, "connect() called by process={} pid={}", comm, pid);
This does not work.
What happens today
aya-log-parser only recognises these format specifiers (source):
| Specifier |
Meaning |
{} |
Default |
{:x} / {:p} |
Lower hex |
{:X} |
Upper hex |
{:i} |
IP address |
{:mac} |
Lower MAC |
{:MAC} |
Upper MAC |
For [u8; 16]:
Versions
Using latest aya: https://docs.rs/aya/0.14.0/aya/
aya-log 0.2.1
aya-log-ebpf 0.1.0
aya-log-parser 0.1.13
- `aya-log-common 0.1.15
Context: I am completely new to rust. Trying to port an existing BCC eBPF implementation to aya.
Disclosure: Heavily using AI agents to code this with limited understanding.
Summary
There is no way to log a process name (comm) from a BPF program using
aya-log-ebpf. This is one of the most common things you want to include in a BPF log line — "which process triggered this event?" — and currently there's no supported path to do it.Background
bpf_get_current_comm()is a standard BPF helper that returns the current process name as a[u8; 16]null-terminated byte array. It is the BPF equivalent of reading/proc/<pid>/comm. Nearly every BPF observability tool logs this.In aya, the natural thing to write is:
This does not work.
What happens today
aya-log-parseronly recognises these format specifiers (source):{}{:x}/{:p}{:X}{:i}{:mac}{:MAC}For
[u8; 16]:Versions
Using latest aya: https://docs.rs/aya/0.14.0/aya/
aya-log 0.2.1aya-log-ebpf 0.1.0aya-log-parser 0.1.13