1 .\" $NetBSD: pflogd.8,v 1.5 2009/03/21 00:15:54 perry Exp $
2 .\" $OpenBSD: pflogd.8,v 1.35 2007/05/31 19:19:47 jmc Exp $
4 .\" Copyright (c) 2001 Can Erkin Acar. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 .Nd packet filter logging daemon
47 is a background daemon which reads packets logged by
53 and writes the packets to a logfile (normally
58 These logs can be reviewed later using the
62 hopefully offline in case there are bugs in the packet parsing code of
66 closes and then re-opens the log file when it receives
70 to rotate logfiles automatically.
74 to flush the current logfile buffers to the disk, thus making the most
75 recent logs available.
76 The buffers are also flushed every
80 If the log file contains data after a restart or a
82 new logs are appended to the existing file.
83 If the existing log file was created with a different snaplen,
85 temporarily uses the old snaplen to keep the log file consistent.
88 tries to preserve the integrity of the log file against I/O errors.
89 Furthermore, integrity of an existing log file is verified before
91 If there is an invalid log file or an I/O error, the log file is moved
92 out of the way and a new one is created.
93 If a new file cannot be created, logging is suspended until a
99 The options are as follows:
104 does not disassociate from the controlling terminal.
106 Time in seconds to delay between automatic flushes of the file.
107 This may be specified with a value between 5 and 3600 seconds.
108 If not specified, the default is 60 seconds.
113 .It Fl i Ar interface
122 Writes a file containing the process ID of the program.
123 The file name has the form
124 .Pa /var/run/pidname.pid .
125 If the option is not given,
130 Analyze at most the first
132 bytes of data from each packet rather than the default of 116.
133 The default of 116 is adequate for IP, ICMP, TCP, and UDP headers but may
134 truncate protocol information for other protocols.
135 Other file parsers may desire a higher snaplen.
137 Check the integrity of an existing log file, and return.
139 Selects which packets will be dumped, using the regular language of
143 .Bl -tag -width /var/run/pflogd.pid -compact
144 .It Pa /var/run/pflogd.pid
145 Process ID of the currently running
147 .It Pa /var/log/pflog
151 Log specific tcp packets to a different log file with a large snaplen
152 (useful with a log-all rule to dump complete sessions):
153 .Bd -literal -offset indent
154 # pflogd -s 1600 -f suspicious.log port 80 and host evilhost
159 interface, excluding specific packets:
160 .Bd -literal -offset indent
161 # pflogd -i pflog3 -f network3.log "not (tcp and port 23)"
165 .Bd -literal -offset indent
166 # tcpdump -n -e -ttt -r /var/log/pflog
169 Display the logs in real time (this does not interfere with the
172 .Bd -literal -offset indent
173 # tcpdump -n -e -ttt -i pflog0
176 Tcpdump has been extended to be able to filter on the pfloghdr
178 .Aq Ar net/if_pflog.h .
179 Tcpdump can restrict the output
180 to packets logged on a specified interface, a rule number, a reason,
181 a direction, an IP family or an action.
183 .Bl -tag -width "ruleset authpf " -compact
185 Address family equals IPv4.
187 Address family equals IPv6.
189 Interface name equals "kue0".
191 Interface name equals "kue0".
193 Ruleset name equals "authpf".
195 Rule number equals 10.
198 Also accepts "bad-offset", "fragment", "bad-timestamp", "short",
199 "normalize", "memory", "congestion", "ip-option", "proto-cksum",
200 "state-mismatch", "state-insert", "state-limit", "src-limit",
204 Also accepts "block".
206 The direction was inbound.
208 The direction was outbound.
211 Display the logs in real time of inbound packets that were blocked on
213 .Bd -literal -offset indent
214 # tcpdump -n -e -ttt -i pflog0 inbound and action block and on wi0
231 .An Can Erkin Acar Aq canacar@openbsd.org .