PFLOG(4)
π PFLOG(4) β like, the packet filter logging interface, bestie β¨
pflog β the Kernel Interfaces Manual's own little icon, fr fr π
β¨ NAME β¨
pflog β the packet filter logging interface, and yes she's that girl π
π¦ SYNOPSIS π¦
device pflog
π DESCRIPTION π
Okay so picture this: the pflog interface is a device that makes visible every single packet the packet filter, pf(4), logs. Like, every packet gets its moment in the spotlight, no cap π. You can watch logged packets in real time β literally just invoke tcpdump(1) on the pflog interface β or you can stash them to disk using pflogd(8). Both are valid, both slay π«Ά.
The pflog0 interface gets created when the pflog module is loaded. Want more instances? Bestie, you can absolutely make more with ifconfig(8) β collect them like stickers πΈ. And the pflog module loads itself automatically if both pf(4) and pflogd(8) are enabled. Self-sufficient queen behavior π.
Every packet you retrieve on this interface comes with a header attached, and that header is exactly PFLOG_HDRLEN bytes long. What's in it? Only the address family, interface name, rule number, reason, action, and direction of the packet that got logged. It's giving β¨receiptsβ¨. This structure lives in β¨net/if_pflog.hβ© and looks like this:
struct pfloghdr {
u_int8_t length;
sa_family_t af;
u_int8_t action;
u_int8_t reason;
char ifname[IFNAMSIZ];
char ruleset[PF_RULESET_NAME_SIZE];
u_int32_t rulenr;
u_int32_t subrulenr;
uid_t uid;
pid_t pid;
uid_t rule_uid;
pid_t rule_pid;
u_int8_t dir;
u_int8_t pad[3];
u_int32_t ridentifier;
};
π EXAMPLES π
Okay, main character demo time β create a pflog interface and monitor every packet logged on it:
# ifconfig pflog create
pflog1
# ifconfig pflog1 up
# tcpdump -n -e -ttt -i pflog1
Ate. No notes. π₯
π SEE ALSO π
tcpdump(1), inet(4), inet6(4), netintro(4), pf(4), ifconfig(8), pflogd(8)
π HISTORY π
The pflog device first appeared in OpenBSD 3.0. A legend since day one π.
π BUGS π
Heads up bestie:FreeBSDdoes not set a process id in thepidfield inpfloghdr. So likeβ¦ that field's just sitting there empty. Not her fault, but you should know π.
That's the whole page, bestie π§ β signed, sealed, and delivered straight from the Debian crew, dated October 29, 2021. Go forth and log responsibly πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2001 Tobias Weingartner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms