Debian Codegraph @

doc/modules/mod_log.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_log</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center>
11 <h2><b>ProFTPD module <code>mod_log</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 This module is contained in the <code>mod_log.c</code> file for
17 ProFTPD 1.3.<i>x</i>, and is compiled by default.
18
19 <h2>Directives</h2>
20 <ul>
21 <li><a href="#AllowLogSymlinks">AllowLogSymlinks</a>
22 <li><a href="#ExtendedLog">ExtendedLog</a>
23 <li><a href="#LogFormat">LogFormat</a>
24 <li><a href="#LogOptions">LogOptions</a>
25 <li><a href="#ServerLog">ServerLog</a>
26 <li><a href="#SystemLog">SystemLog</a>
27 </ul>
28
29 <hr>
30 <h3><a name="AllowLogSymlinks">AllowLogSymlinks</a></h3>
31 <strong>Syntax:</strong> AllowLogSymlinks <em>on|off</em><br>
32 <strong>Default:</strong> None<br>
33 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
34 <strong>Module:</strong> mod_log<br>
35 <strong>Compatibility:</strong> 1.2.2rc2 and later
36
37 <p>
38 By default, the server will the path of any configured
39 <a href="#SystemLog"><code>SystemLog</code></a>, any configured
40 <a href="mod_core.html#TransferLog"><code>TransferLog</code></a>s, and any
41 configured <a href="#ExtendedLog"><code>ExtendedLog</code></a>s to see if they
42 are symbolic links. If the paths <i>are</i> symbolic links, <code>proftpd</code>
43 will refuse to log to that link unless explicitly configured to do so via
44 this <code>AllowLogSymlinks</code> directive.
45
46 <p>
47 <b>Security Note</b>: This behaviour should not be allowed unless for a very
48 good reason. By allowing the server to open symbolic links with its root
49 privileges, you are allowing a potential symlink attack where the server could
50 be tricked into overwriting arbitrary system files. <i>You have been
51 warned.</i>
52
53 <p>
54 <hr>
55 <h3><a name="ExtendedLog">ExtendedLog</a></h3>
56 <strong>Syntax:</strong> ExtendedLog <em>path [cmd-classes [format-name]]</em><br>
57 <strong>Default:</strong> None<br>
58 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code>, <code>&lt;Anonymous&gt;</code><br>
59 <strong>Module:</strong> mod_log<br>
60 <strong>Compatibility:</strong> 1.1.6p11 and later
61
62 <p>
63 The <code>ExtendedLog</code> directive allows customizable logfiles to be
64 generated, either globally or per <code>&lt;VirtualHost&gt;</code>. The
65 <em>path</em> argument should contain an absolute pathname to a logfile which
66 will be appended to when <code>proftpd</code> starts; the pathname should
67 <b>not</b> be to a file in a nonexistent directory, to a world-writable
68 directory, or be a symbolic link (unless
69 <a href="#AllowLogSymlinks"><code>AllowLogSymlinks</code></a> is set to
70 <em>on</em>). Multiple logfiles, potentially with different command classes and
71 formats) can be created. Optionally, the <em>cmd-classes</em> parameter can be
72 used to control which types of commands are logged. If no command classes are
73 specified, <code>proftpd</code> logs all commands by default.
74 <b>Note</b> that passwords are hidden. If used, the <em>cmd-classes</em>
75 parameter is a comma-delimited (with <b>no whitespace</b>) list of which
76 commands to log.
77
78 <p>
79 In <code>proftpd-1.2.8rc1</code> and later, the <em>path</em> argument can
80 be of the form &quot;syslog:<i>level</i>&quot;. The &quot;syslog:&quot; prefix
81 configures <code>mod_log</code> to write the <code>ExtendedLog</code> data
82 to syslog rather than to a file. The <i>level</i> configures the syslog
83 level at which to log the data. For example:
84 <pre>
85 ExtendedLog syslog:info ALL default
86 </pre>
87
88 <p>
89 This table shows the supported command classes:
90 <p>
91 <table border=1 summary="Command Classes">
92 <tr>
93 <td><b>Command Class</b></td>
94 <td><b>FTP Commands</b></td>
95 </tr>
96
97 <tr>
98 <td><code>ALL</code></td>
99 <td>All commands <i>except</i> the <code>EXIT</code> pseudo-command (<i>default</i>)</td>
100 </tr>
101
102 <tr>
103 <td><code>NONE</code></td>
104 <td>No commands</td>
105 </tr>
106
107 <tr>
108 <td><code>AUTH</code></td>
109 <td>Authentication commands: <code>ACCT</code>, <code>PASS</code>,
110 <code>REIN</code>, <code>USER</code></td>
111 </tr>
112
113 <tr>
114 <td><code>INFO</code></td>
115 <td>Informational commands: <code>FEAT</code>, <code>HELP</code>,
116 <code>MDTM</code>, <code>QUIT</code>, <code>PWD</code>, <code>STAT</code>,
117 <code>SIZE</code>, <code>SYST</code>, <code>XPWD</code></td>
118 </tr>
119
120 <tr>
121 <td><code>DIRS</code></td>
122 <td>Directory commands: <code>CDUP</code>, <code>CWD</code>,
123 <code>LIST</code>, <code>MKD</code>, <code>MLSD</code>, <code>MLST</code>,
124 <code>NLST</code>, <code>RMD</code>, <code>XCWD</code>, <code>XCUP</code>,
125 <code>XMKD</code>, <code>XRMD</code></td>
126 </tr>
127
128 <tr>
129 <td><code>READ</code></td>
130 <td>File reading: <code>RETR</code></td>
131 </tr>
132
133 <tr>
134 <td><code>WRITE</code></td>
135 <td>File/directory writing or creation: <code>APPE</code>, <code>MFF</code>,
136 <code>MFMT</code>, <code>MKD</code>, <code>RMD</code>, <code>RNFR</code>,
137 <code>RNTO</code>, <code>STOR</code>, <code>STOU</code>,
138 <code>XMKD</code>, <code>XRMD</code></td>
139 </tr>
140
141 <tr>
142 <td><code>MISC</code></td>
143 <td>Miscellaneous commands: <code>ABOR</code>, <code>ALLO</code>,
144 <code>EPRT</code>, <code>EPSV</code>, <code>MODE</code>,
145 <code>NOOP</code>, <code>OPTS</code>, <code>PASV</code>,
146 <code>PORT</code>, <code>REST</code>, <code>RNFR</code>,
147 <code>RNTO</code>, <code>SITE</code>, <code>SMNT</code>,
148 <code>STRU</code>, <code>TYPE</code></td>
149 </tr>
150
151 <tr>
152 <td><code>SEC</code></td>
153 <td>RFC2228-related security FTP commands: <code>AUTH</code>,
154 <code>CCC</code>, <code>PBSZ</code>, <code>PROT</code>. <b>Note</b>:
155 this class also includes SSH key exchange commands.</td>
156 </tr>
157
158 <tr>
159 <td><code>EXIT</code></td>
160 <td>Logs the configured <code>LogFormat</code> at session exit.<br>
161 <b>NOTE</b>: <code>EXIT</code> is <b>not</b> part of the
162 <code>ALL</code> command class, in order to preserve
163 backward-compatible <code>ALL</code> behavior.</td>
164 </tr>
165 </table>
166
167 <p>
168 If a <em>format-name</em> parameter is used, <code>ExtendedLog</code> will
169 use the named <a href="#LogFormat"><code>LogFormat</code></a>. Otherwise, the
170 default format of "%h %l %u %t \"%r\" %s %b" is used.
171
172 <p>
173 For example, to log all read and write operations to
174 <code>/var/log/ftp.log</code> using the default format, use:
175 <pre>
176 ExtendedLog /var/log/ftp.log READ,WRITE
177 </pre>
178 and to log all read and write operations to <code>/var/log/ftp.log</code>
179 using your own <code>LogFormat</code> named "custom", use:
180 <pre>
181 LogFormat custom ...
182 ExtendedLog /var/log/ftp.log READ,WRITE custom
183 </pre>
184
185 <p>
186 See also: <a href="#AllowLogSymlinks"><code>AllowLogSymlinks</code></a>,
187 <a href="#LogFormat"><code>LogFormat</code></a>,
188 <a href="mod_core.html#TransferLog"><code>TransferLog</code></a>
189
190 <p>
191 <hr>
192 <h3><a name="LogFormat">LogFormat</a></h3>
193 <strong>Syntax:</strong> LogFormat <em>format-name format-string</em><br>
194 <strong>Default:</strong> LogFormat default "%h %l %u %t \"%r\" %s %b"<br>
195 <strong>Context:</strong> server config, <code>&lt;Global&gt;</code><br>
196 <strong>Module:</strong> mod_log<br>
197 <strong>Compatibility:</strong> 1.1.6p11 and later
198
199 <p>
200 The <code>LogFormat</code> directive can be used to create a custom logging
201 format for use with the <a href="#ExtendedLog"><code>ExtendedLog</code></a>
202 directive. Once created, the format can be referenced by the specified
203 <em>format-name</em>. The <em>format-string</em> parameter can consist of
204 any combination of letters, numbers and symbols. The special character '%' is
205 used to start a meta sequence/variable (see below). To insert a literal '%'
206 character, use "%%".
207
208 <p>
209 The default <code>LogFormat</code> is:
210 <pre>
211 "%h %l %u %t \"%r\" %s %b"
212 </pre>
213 which produces log entries in the <a href="http://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format">Common Log Format</a>.
214
215 <p>
216 The following meta sequences/variables are available and are replaced as
217 indicated when logging.
218
219 <p>
220 <table border=1 summary="LogFormat Variables">
221 <tr>
222 <td><b>Variable</b></td>
223 <td><b>Value</b></td>
224 </tr>
225
226 <tr>
227 <td>&nbsp;<code>%a</code>&nbsp;</td>
228 <td>Remote client IP address</td>
229 </tr>
230
231 <tr>
232 <td>&nbsp;<code>%A</code>&nbsp;</td>
233 <td>Anonymous login password, or "UNKNOWN" for regular logins</td>
234 </tr>
235
236 <tr>
237 <td>&nbsp;<code>%{basename}</code>&nbsp;</td>
238 <td>Last component of path, <i>i.e.</i> just the file or directory name.</td>
239 </tr>
240
241 <tr>
242 <td>&nbsp;<code>%b</code>&nbsp;</td>
243 <td>Number of bytes sent for this command</td>
244 </tr>
245
246 <tr>
247 <td>&nbsp;<code>%c</code>&nbsp;</td>
248 <td>Client connection class, or "-" if undefined</td>
249 </tr>
250
251 <tr>
252 <td>&nbsp;<code>%d</code>&nbsp;</td>
253 <td>Directory name (<i>not</i> full path) for: <code>CDUP</code>,
254 <code>CWD</code>, <code>LIST</code>, <code>MLSD</code>, <code>MKD</code>,
255 <code>NLST</code>, <code>RMD</code>, <code>XCWD</code>, <code>XCUP</code>,
256 <code>XMKD</code>, <code>XRMD</code></td>
257 </tr>
258
259 <tr>
260 <td>&nbsp;<code>%D</code>&nbsp;</td>
261 <td>Directory path (full path) for: <code>CDUP</code>,
262 <code>CWD</code>, <code>LIST</code>, <code>MLSD</code>, <code>MKD</code>,
263 <code>NLST</code>, <code>RMD</code>, <code>XCWD</code>, <code>XCUP</code>,
264 <code>XMKD</code>, <code>XRMD</code></td>
265 </tr>
266
267 <tr>
268 <td>&nbsp;<code>%E</code>&nbsp;</td>
269 <td>End-of-session reason</td>
270 </tr>
271
272 <tr>
273 <td>&nbsp;<code>%{epoch}</code>&nbsp;</td>
274 <td>Unix epoch; seconds since January 1, 1970</td>
275 </tr>
276
277 <tr>
278 <td>&nbsp;<code>%{<em>NAME</em>}e</code>&nbsp;</td>
279 <td>Contents of environment variable <em>NAME</em></td>
280 </tr>
281
282 <tr>
283 <td>&nbsp;<code>%f</code>&nbsp;</td>
284 <td>Absolute path of the filename stored or retrieved (not chrooted)</td>
285 </tr>
286
287 <tr>
288 <td>&nbsp;<code>%F</code>&nbsp;</td>
289 <td>Filename stored or retrieved, as the client sees it</td>
290 </tr>
291
292 <tr>
293 <td>&nbsp;<code>%{file-modified}</code>&nbsp;</td>
294 <td>Indicates whether a file is modified (<i>i.e.</i> already exists): "true" or "false"</td>
295 </tr>
296
297 <tr>
298 <td>&nbsp;<code>%{file-size}</code>&nbsp;</td>
299 <td>Indicates the file size <b>after</b> data transfer, or "-" if not applicable</td>
300 </tr>
301
302 <tr>
303 <td>&nbsp;<code>%{gid}</code>&nbsp;</td>
304 <td>GID of authenticated user</td>
305 </tr>
306
307 <tr>
308 <td>&nbsp;<code>%g</code>&nbsp;</td>
309 <td>Primary group of authenticated user</td>
310 </tr>
311
312 <tr>
313 <td>&nbsp;<code>%h</code>&nbsp;</td>
314 <td>Remote client DNS name</td>
315 </tr>
316
317 <tr>
318 <td>&nbsp;<code>%H</code>&nbsp;</td>
319 <td>Local IP address of vhost/server hosting/handling the session</td>
320 </tr>
321
322 <tr>
323 <td>&nbsp;<code>%I</code>&nbsp;</td>
324 <td>Total number of "raw" bytes read in from network</td>
325 </tr>
326
327 <tr>
328 <td>&nbsp;<code>%{iso8601}</code>&nbsp;</td>
329 <td>shorthand form of <code>%{%Y-%m-%d %H:%M:%S}t,%{millisecs}</code>, <i>e.g.</i> "2013-01-30 20:14:05,670"</td>
330 </tr>
331
332 <tr>
333 <td>&nbsp;<code>%J</code>&nbsp;</td>
334 <td>Command arguments received from client, <i>e.g.</i> "file.txt"</td>
335 </tr>
336
337 <tr>
338 <td>&nbsp;<code>%l</code>&nbsp;</td>
339 <td>Remote username (from <code>identd</code>), or "UNKNOWN" if IdentLookup
340 failed</td>
341 </tr>
342
343 <tr>
344 <td>&nbsp;<code>%L</code>&nbsp;</td>
345 <td>Local IP address contacted by client</td>
346 </tr>
347
348 <tr>
349 <td>&nbsp;<code>%m</code>&nbsp;</td>
350 <td>Command (method) name received from client, <i>e.g.</i> <code>RETR</code></td>
351 </tr>
352
353 <tr>
354 <td>&nbsp;<code>%{microsecs}</code>&nbsp;</td>
355 <td>6 digit value of the microseconds of the current time</td>
356 </tr>
357
358 <tr>
359 <td>&nbsp;<code>%{millisecs}</code>&nbsp;</td>
360 <td>3 digit value of the milliseconds of the current time</td>
361 </tr>
362
363 <tr>
364 <td>&nbsp;<code>%O</code>&nbsp;</td>
365 <td>Total number of "raw" bytes written out to network</td>
366 </tr>
367
368 <tr>
369 <td>&nbsp;<code>%p</code>&nbsp;</td>
370 <td>Local port</td>
371 </tr>
372
373 <tr>
374 <td>&nbsp;<code>%P</code>&nbsp;</td>
375 <td>Local server process ID (pid)</td>
376 </tr>
377
378 <tr>
379 <td>&nbsp;<code>%{protocol}</code>&nbsp;</td>
380 <td>Current protocol: "ftp", "ftps", "ssh2", "sftp", "scp"</td>
381 </tr>
382
383 <tr>
384 <td>&nbsp;<code>%r</code>&nbsp;</td>
385 <td>Full command received from client</td>
386 </tr>
387
388 <tr>
389 <td>&nbsp;<code>%R</code>&nbsp;</td>
390 <td>Response time, in milliseconds</td>
391 </tr>
392
393 <tr>
394 <td>&nbsp;<code>%{remote-port}</code>&nbsp;</td>
395 <td>Remote client port</td>
396 </tr>
397
398 <tr>
399 <td>&nbsp;<code>%s</code>&nbsp;</td>
400 <td>Numeric FTP response code (status); see <a href="http://www.faqs.org/rfcs/rfc959.html">RFC 959</a> Section 4.2.1</td>
401 </tr>
402
403 <tr>
404 <td>&nbsp;<code>%S</code>&nbsp;</td>
405 <td>Response message sent to client (available since 1.3.1rc1)</td>
406 </tr>
407
408 <tr>
409 <td>&nbsp;<code>%t</code>&nbsp;</td>
410 <td>Current local time</td>
411 </tr>
412
413 <tr>
414 <td>&nbsp;<code>%{<em>format</em>}t</code>&nbsp;</td>
415 <td>Current local time using <code>strftime(3)</code> <em>format</em></td>
416 </tr>
417
418 <tr>
419 <td>&nbsp;<code>%T</code>&nbsp;</td>
420 <td>Time taken to transfer file, in seconds</td>
421 </tr>
422
423 <tr>
424 <td>&nbsp;<code>%{transfer-failure}</code>&nbsp;</td>
425 <td>Reason for data transfer failure (if applicable), or "-"</td>
426 </tr>
427
428 <tr>
429 <td>&nbsp;<code>%{transfer-millisecs}</code>&nbsp;</td>
430 <td>Time taken to transfer file, in milliseconds</td>
431 </tr>
432
433 <tr>
434 <td>&nbsp;<code>%{transfer-port}</code>&nbsp;</td>
435 <td>Remote port used for data transfer</td>
436 </tr>
437
438 <tr>
439 <td>&nbsp;<code>%{transfer-speed}</code>&nbsp;</td>
440 <td>Data transfer speed, in KB/s</td>
441 </tr>
442
443 <tr>
444 <td>&nbsp;<code>%{transfer-status}</code>&nbsp;</td>
445 <td>Status of data transfer: "success", "failed", "cancelled", "timeout", or "-"</td>
446 </tr>
447
448 <tr>
449 <td>&nbsp;<code>%{transfer-type}</code>&nbsp;</td>
450 <td>Data transfer type: "binary" or "ASCII" (if applicable), or "-"</td>
451 </tr>
452
453 <tr>
454 <td>&nbsp;<code>%u</code>&nbsp;</td>
455 <td>Authenticated local username</td>
456 </tr>
457
458 <tr>
459 <td>&nbsp;<code>%U</code>&nbsp;</td>
460 <td><code>USER</code> name originally sent by client</td>
461 </tr>
462
463 <tr>
464 <td>&nbsp;<code>%{uid}</code>&nbsp;</td>
465 <td>UID of authenticated user</td>
466 </tr>
467
468 <tr>
469 <td>&nbsp;<code>%v</code>&nbsp;</td>
470 <td>Local server <code>ServerName</code></td>
471 </tr>
472
473 <tr>
474 <td>&nbsp;<code>%V</code>&nbsp;</td>
475 <td>Local server DNS name</td>
476 </tr>
477
478 <tr>
479 <td>&nbsp;<code>%{version}</code>&nbsp;</td>
480 <td>ProFTPD version</td>
481 </tr>
482
483 <tr>
484 <td>&nbsp;<code>%w</code>&nbsp;</td>
485 <td>Absolute path for the <code>RNFR</code> path ("whence" a rename comes)</td>
486 </tr>
487 </table>
488
489 <p>
490 See also: <a href="#ExtendedLog"><code>ExtendedLog</code></a>,
491 <a href="mod_core.html#TransferLog"><code>TransferLog</code></a>
492
493 <p>
494 <hr>
495 <h3><a name="LogOptions">LogOptions</a></h3>
496 <strong>Syntax:</strong> LogOptions <em>opt1 ... optN</em><br>
497 <strong>Default:</strong> None<br>
498 <strong>Context:</strong> server config, &lt;VirtualHost&gt;, &lt;Global&gt;<br>
499 <strong>Module:</strong> mod_core<br>
500 <strong>Compatibility:</strong> 1.3.7rc4 and later
501
502 <p>
503 The <code>LogOptions</code> directive can be used to change the format
504 of the <a href="#SystemLog"><code>SystemLog</code></a> messages, <i>e.g.</i>
505 adding/remove certain fields of data. These options <i>also</i> apply to
506 all module logging; ProFTPD logging is centralized, and the
507 <code>LogOptions</code> are applied to any/all logging.
508
509 <p>
510 The options supported by the <code>LogOptions</code> directive are:
511 <ul>
512 <li>Hostname
513 <li>RoleBasedProcessLabels
514 <li>Timestamp
515 <li>VirtualHost
516 </ul>
517 All of these options are <em>enabled</em> by default, <i>except</i> for the
518 <code>RoleBasedProcessLabels</code> option.
519
520 <p>
521 To enable an option, preface the option name with a '+' (plus) character;
522 to disable the option, use a '-' (minus) character prefix. For example:
523 <pre>
524 # Log messages without timestamps or hostname
525 LogOptions -Hostname -Timestamp
526 </pre>
527
528 <p>
529 The <code>RoleBasedProcessLabels</code> option changes the <em>label</em>
530 just for the PID, from <i>e.g.</i>:
531 <pre>
532 proftpd[1234]
533 </pre>
534 to one of the following, depending on whether the process is the master
535 <em>daemon</em> process, or a forked <em>session</em> process:
536 <pre>
537 daemon[2345]
538 session[34567]
539 </pre>
540 This is useful, for example, when relying on <code>systemd</code> logging:
541 <pre>
542 LogOptions -Timestamp -Hostname +RoleBasedProcessLabels
543 </pre>
544
545 <p>
546 <hr>
547 <h3><a name="ServerLog">ServerLog</a></h3>
548 <strong>Syntax:</strong> ServerLog <em>path</em>|"none"<br>
549 <strong>Default:</strong> None<br>
550 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
551 <strong>Module:</strong> mod_log<br>
552 <strong>Compatibility:</strong> 1.2.8rc1 and later
553
554 <p>
555 The <code>ServerLog</code> directive is used to configure a
556 <code>&lt;VirtualHost&gt;</code>-specific logfile at the given <em>path</em>,
557 rather than a single <a href="#SystemLog"><code>SystemLog</code></a> for the
558 entire configuration.
559
560 <p>
561 A <em>path</em> value of "none" will disable file logging for that vhost;
562 this can be used to override a global <code>ServerLog</code> setting.
563
564 <p>
565 <hr>
566 <h3><a name="SystemLog">SystemLog</a></h3>
567 <strong>Syntax:</strong> SystemLog <em>path</em>|"none"<br>
568 <strong>Default:</strong> None<br>
569 <strong>Context:</strong> server config, <code>&lt;Global&gt;</code><br>
570 <strong>Module:</strong> mod_log<br>
571 <strong>Compatibility:</strong> 1.1.6p11 and later
572
573 <p>
574 The <code>SystemLog</code> directive disables ProFTPD's use of the
575 <code>syslog</code> mechanism and instead redirects all logging output to the
576 specified <em>path</em>. The <em>path</em> should contain an absolute path,
577 and should not be to a file in a nonexistent directory, in a world-writable
578 directory, or be a symbolic link (unless
579 <a href="#AllowLogSymlinks"><code>AllowLogSymlinks</code></a> is set to
580 <em>on</em>).
581
582 <p>
583 Use of this directive overrides any facility set by the
584 <a href="mod_core.html#SyslogFacility"><code>SyslogFacility</code></a>
585 directive.
586
587 <p>
588 A <em>path</em> value of "none" will disable logging for the entire daemon.
589
590 <p>
591 If you find that your ProFTPD installation appears to be ignoring your
592 <code>SystemLog</code> configuration entirely, <em>and</em> your ProFTPD
593 service is managed/run by <code>systemd</code>, then you may be encountering
594 <a href="#SystemdNodaemon">this FAQ</a>.
595
596 <p>
597 <hr>
598 <h2><a name="Installation">Installation</a></h2>
599 The <code>mod_log</code> module is compiled by default.
600
601 <p>
602 <hr>
603 <h2><a name="Usage">Usage</a></h2>
604 <p>
605
606 <p><a name="FAQ">
607 <b>Frequently Asked Questions</b><br>
608
609 <p><a name="LogLevel">
610 <font color=red>Question</font>: Why are successful logins no longer being
611 logged, after upgrading to ProFTPD 1.3.6, even though I am using the
612 <code>SystemLog</code> directive?<br>
613 <font color=blue>Answer</font>: The default log level was changed from
614 <code>DEBUG</code> to <code>NOTICE</code> in ProFTPD 1.3.6; see
615 <a href="http://bugs.proftpd.org/show_bug.cgi?id=3983">Bug#3983</a>. And
616 the "Login successful" log message is logged at the <code>INFO</code> level,
617 which means that it will <em>not</em> be logged by default.
618
619 <p>
620 Why not? The <code>INFO</code> log level is for "normal operating conditions"
621 (see the <a href="../howto/LogLevels.html">log levels</a> howto), and successful
622 logins are considered normal, and thus are not noteworthy or needed for logging.
623 <em>Failed</em> logins, however, <em>are</em> logged at the <code>NOTICE</code>
624 log level.
625
626 <p>
627 For having successful logins logged once more, use the following in your
628 <code>proftpd.conf</code>:
629 <pre>
630 SyslogLevel INFO
631 </pre>
632
633 <p><a name="SystemdNodaemon">
634 <font color=red>Question</font>: I configured <a href="#SystemLog"><code>SystemLog</code></a> in my ProFTPD configuration, but ProFTPD still logs only to syslog. What is missing?<br>
635 <font color=blue>Answer</font>: The most common cause for this behavior is the
636 use of <code>systemd</code> for running ProFTPD. In particular, the <code>systemd</code> unit file for ProFTPD in some installations unexpectedly uses the
637 <code>--nodaemon</code> command-line option, <i>e.g.</i>:
638 <pre>
639 # /usr/lib/systemd/system/proftpd.service
640 ...
641 [Service]
642 Type = simple
643 Environment = PROFTPD_OPTIONS=
644 EnvironmentFile = -/etc/sysconfig/proftpd
645 ExecStartPre = /usr/sbin/proftpd --configtest
646 ExecStart = /usr/sbin/proftpd --nodaemon $PROFTPD_OPTIONS
647 ExecReload = /bin/kill -HUP $MAINPID
648 PIDFile = /run/proftpd/proftpd.pid
649
650 ...
651 </pre>
652 When ProFTPD is started with the <code>-n/--nodaemon</code> command-line option,
653 it will <em>only</em> log to stdout, and <b>not</b> to any configured log files.
654 This configuration is useful, for example, when running ProFTPD in a Docker
655 container.
656
657 <p>
658 A slightly different <code>systemd</code> unit file for ProFTPD will work just
659 as well, <i>and</i> will honor the <code>SystemLog</code> configuration as
660 expected:
661 <pre>
662 ...
663 [Service]
664 Type = forking
665 Environment = PROFTPD_OPTIONS=
666 EnvironmentFile = -/etc/sysconfig/proftpd
667 ExecStartPre = /usr/sbin/proftpd --configtest $PROFTPD_OPTIONS
668 ExecStart = /usr/sbin/proftpd $PROFTPD_OPTIONS
669 ExecReload = /bin/kill -HUP $MAINPID
670 PIDFile = /run/proftpd/proftpd.pid
671
672 ...
673 </pre>
674
675 <p><a name="NoDNSNames">
676 <font color=red>Question</font>: I have configured ProFTPD to use DNS names
677 in my <code>proftpd.conf</code> using:
678 <pre>
679 UseReverseDNS on
680 </pre>
681 But in my <code>ExtendedLog</code>, I still see IP addresses rather than the
682 DNS names I expect to see. How can that happen?<br>
683 <font color=blue>Answer</font>: The
684 <a href="#LogFormat"><code>LogFormat</code></a> <code>%h</code> is what is used
685 to log DNS names. The logged value might be an IP address if ProFTPD cannot
686 properly verify that the client IP address resolves to a DNS name.
687
688 <p>
689 "Properly verifying" an IP address, in this case, means resolving the DNS name
690 for an IP address <em>and then resolving that DNS name back to its IP
691 addresses</em>:
692 <pre>
693 $ host 10.1.2.3
694 3.2.1.10.in-addr.arpa domain name pointer host.domain.example.com.
695 $ host host.domain.example.com
696 host.domain.example.com has address 10.4.5.6
697 </pre>
698 In this example, the IP address 10.1.2.3 does not resolve back to itself via
699 DNS, but rather to a <i>different</i> IP address.
700
701 <p>
702 If the DNS name does not resolve back to the original IP address, then that
703 DNS name is <b>not used</b>, as that DNS name is considered "unreliable"; only
704 <em>reliable</em> information is logged (and used elsewhere). Thus ProFTPD
705 resorts to logging just the client IP address for the <code>%h</code> variable,
706 rather than the DNS name, in these situations.
707
708 <p><a name="LogDisconnectionReason">
709 <font color=red>Question</font>: How can I get the reason a client was
710 disconnected, for whatever reason, logged to my <code>ExtendedLog</code>?<br>
711 <font color=blue>Answer</font>: You can use the <code>%E</code>
712 <a href="#LogFormat"><code>LogFormat</code></a> variable for this, <b>in
713 conjunction with</b> the <code>EXIT</code> log class.
714
715 <p>
716 For example, assume you have configured the following:
717 <pre>
718 MaxConnectionsPerUser 2
719 </pre>
720 and you would like your <code>ExtendedLog</code> to record when this limit
721 is reached. To do this, you would use something like the following:
722 <pre>
723 LogFormat eos "%a: user=%U disconnect_reason=\"%E\""
724 ExtendedLog /var/log/proftpd/ext.log EXIT eos
725 </pre>
726 Of course, you can include other logging classes than just <code>EXIT</code>;
727 the above is just an example.
728
729 <p>
730 With the above, when the <code>MaxConnectionsPerUser</code> is reached,
731 your log would have a line like:
732 <pre>
733 127.0.0.1: user=tj disconnect_reason="Denied by MaxConnectionsPerUser"
734 </pre>
735
736 <p>
737 <hr>
738 <font size=2><b><i>
739 &copy; Copyright 2002-2024 The ProFTPD Project<br>
740 All Rights Reserved<br>
741 </i></b></font>
742
743 <hr>
744 </body>
745 </html>