Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pflog(4) [centos man page]

PFLOG(4)                                                   BSD Kernel Interfaces Manual                                                   PFLOG(4)

pflog -- packet filter logging interface SYNOPSIS
device pflog DESCRIPTION
The pflog interface is a pseudo-device which makes visible all packets logged by the packet filter, pf(4). Logged packets can easily be mon- itored in real time by invoking tcpdump(1) on the pflog interface, or stored to disk using pflogd(8). The pflog0 interface is created automatically at boot if both pf(4) and pflogd(8) are enabled; further instances can be created using ifconfig(8). Each packet retrieved on this interface has a header associated with it of length PFLOG_HDRLEN. This header documents the address family, interface name, rule number, reason, action, and direction of the packet that was logged. This structure, defined in <net/if_pflog.h> looks like 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]; }; EXAMPLES
Create a pflog interface and monitor all packets logged on it: # ifconfig pflog1 up # tcpdump -n -e -ttt -i pflog1 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. BSD December 10, 2001 BSD

Check Out this Related Man Page

PFLOGD(8)						    BSD System Manager's Manual 						 PFLOGD(8)

pflogd -- packet filter logging daemon SYNOPSIS
pflogd [-DragonFly] [-d delay] [-f filename] [-i interface] [-p pidfile] [-s snaplen] [expression] DESCRIPTION
pflogd is a background daemon which reads packets logged by pf(4) to a pflog(4) interface, normally pflog0, and writes the packets to a log- file (normally /var/log/pflog) in tcpdump(8) binary format. These logs can be reviewed later using the -r option of tcpdump(8), hopefully offline in case there are bugs in the packet parsing code of tcpdump(8). pflogd closes and then re-opens the log file when it receives SIGHUP, permitting newsyslog(8) to rotate logfiles automatically. SIGALRM causes pflogd to flush the current logfile buffers to the disk, thus making the most recent logs available. The buffers are also flushed every delay seconds. If the log file contains data after a restart or a SIGHUP, new logs are appended to the existing file. If the existing log file was created with a different snaplen, pflogd temporarily uses the old snaplen to keep the log file consistent. pflogd tries to preserve the integrity of the log file against I/O errors. Furthermore, integrity of an existing log file is verified before appending. If there is an invalid log file or an I/O error, the log file is moved out of the way and a new one is created. If a new file cannot be created, logging is suspended until a SIGHUP or a SIGALRM is received. The options are as follows: -D Debugging mode. pflogd does not disassociate from the controlling terminal. -d delay Time in seconds to delay between automatic flushes of the file. This may be specified with a value between 5 and 3600 seconds. If not specified, the default is 60 seconds. -f filename Log output filename. Default is /var/log/pflog. -i interface Specifies the pflog(4) interface to use. By default, pflogd will use pflog0. -p pidfile Writes a file containing the process ID of the program. The file name has the form /var/run/ If the option is not given, pidfile defaults to pflogd. -s snaplen Analyze at most the first snaplen bytes of data from each packet rather than the default of 116. The default of 116 is adequate for IP, ICMP, TCP, and UDP headers but may truncate protocol information for other protocols. Other file parsers may desire a higher snaplen. -x Check the integrity of an existing log file, and return. expression Selects which packets will be dumped, using the regular language of tcpdump(8). FILES
/var/run/ Process ID of the currently running pflogd. /var/log/pflog Default log file. EXAMPLES
Log specific tcp packets to a different log file with a large snaplen (useful with a log-all rule to dump complete sessions): # pflogd -s 1600 -f suspicious.log port 80 and host evilhost Log from another pflog(4) interface, excluding specific packets: # pflogd -i pflog3 -f network3.log "not (tcp and port 23)" Display binary logs: # tcpdump -n -e -ttt -r /var/log/pflog Display the logs in real time (this does not interfere with the operation of pflogd): # tcpdump -n -e -ttt -i pflog0 Tcpdump has been extended to be able to filter on the pfloghdr structure defined in <net/if_pflog.h>. Tcpdump can restrict the output to packets logged on a specified interface, a rule number, a reason, a direction, an IP family or an action. ip Address family equals IPv4. ip6 Address family equals IPv6. ifname kue0 Interface name equals "kue0". on kue0 Interface name equals "kue0". ruleset authpf Ruleset name equals "authpf". rulenum 10 Rule number equals 10. reason match Reason equals match. Also accepts "bad-offset", "fragment", "bad-timestamp", "short", "normalize", "memory", "congestion", "ip-option", "proto-cksum", "state-mismatch", "state-insert", "state-limit", "src-limit", and "synproxy". action pass Action equals pass. Also accepts "block". inbound The direction was inbound. outbound The direction was outbound. Display the logs in real time of inbound packets that were blocked on the wi0 interface: # tcpdump -n -e -ttt -i pflog0 inbound and action block and on wi0 SEE ALSO
pcap(3), pf(4), pflog(4), pf.conf(5), newsyslog(8), tcpdump(8) HISTORY
The pflogd command appeared in OpenBSD 3.0. AUTHORS
pflogd was written by Can Erkin Acar <>. BSD
May 31, 2007 BSD
Man Page