Debian Codegraph @

doc/howto/Logging.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD: Logging</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr>
10 <center><h2><b><i>ProFTPD: Logging</i></b></h2></center>
11 <hr>
12
13 <p>
14 <b>Logging</b><br>
15 Logging the activity of the server is an integral part of effective server
16 administration. ProFTPD provides several different and flexing logging
17 mechanisms. When examining the different logging mechanisms, have in
18 mind the intended use of the logged data, the volume of data being logged,
19 any post-processing that may need to be done, <i>etc</i>. Log files are more
20 useful when they contain a complete record of server activity. It is often
21 easier to simply post-process the log files to remove requests that you do not
22 want to consider.
23
24 <p>
25 <b>Security Warning</b><br>
26 Anyone who can write to the directory where ProFTPD is writing a log file can
27 almost certainly gain access to the UID that the server is started under, which
28 is normally <code>root</code>. <b>Do not</b> give people write access to the
29 directory where the logs are stored without being aware of the consequences:
30 if the logs directory is writable (by a non-<code>root</code> user), someone
31 could replace a log file with a symlink to some other system file, and then
32 <code>root</code> might overwrite that file with arbitrary data. If the log
33 files themselves are writable (by a non-<code>root</code> user), then someone
34 may be able to overwrite the log itself with bogus data.
35
36 <p>
37 When opening log files, <code>proftpd</code> will by default log a warning if
38 the file being opened for logging is in a directory that does not exist, or
39 is world-writable. The log file will <b>not</b> be written in world-writable
40 directories; there are no exceptions. (If you have configured log files in
41 your <code>proftpd.conf</code> that are not appearing, check for the warnings
42 about world-writable directories.) The <code>proftpd</code> process will also,
43 by default, log a warning if the file given is a symlink; this symlink check
44 can be configured via the <a href="../modules/mod_log.html#AllowLogSymlinks"><code>AllowLogSymlinks</code></a> directive.
45
46 <p>
47 In addition, log files may contain information supplied directly by the client,
48 without escaping. Therefore, it is possible for malicious clients to insert
49 control-characters in the log files, so care must be taken in dealing with
50 raw logs.
51
52 <p><a name="Syslog"></a>
53 <b>Unix <code>syslog</code> Logging</b><br>
54 By default, <code>proftpd</code> will log via <code>syslog(3)</code>, using
55 the <code>daemon</code> facility (<code>auth</code> for some logging),
56 at various levels: <code>err</code>, <code>notice</code>, <code>warn</code>,
57 <code>info</code>, and <code>debug</code> (debugging is done at this syslog
58 level). The location of the server's log files in this case is determined by
59 your <code>/etc/syslog.conf</code> configuration.
60
61 <p>
62 You can fine-tune your <code>proftpd</code>'s syslog-based logging via the
63 <a href="../modules/mod_core.html#SyslogFacility"><code>SyslogFacility</code></a> and <a href="../modules/mod_core.html#SyslogLevel"><code>SyslogLevel</code></a> directives. See the <a href="LogLevels.html">log level</a> documentation for
64 more details on these settings.
65
66 <p><a name="LogFiles"></a>
67 <b>Log Files</b><br>
68 There are three main types of logs that a <code>proftpd</code> daemon can
69 generate: <code>TransferLog</code>, <code>SystemLog</code>, and
70 <code>ExtendedLog</code>.
71
72 <p><a name="TransferLog"></a>
73 <b><i><code>TransferLog</code></i></b><br>
74 A <a href="../modules/mod_core.html#TransferLog"><code>TransferLog</code></a>
75 is the most common log kept, recording file transfers. It is written in the
76 <code>xferlog(5)</code> format, described here, <b>and</b> in the
77 <code>xferlog(5)</code> man page.
78
79 <p>
80 Each entry in the <code>TransferLog</code> is a single line of space-delimited
81 fields:
82 <table border=1 summary="TransferLog Fields">
83 <tr>
84 <td>&nbsp;<b>Field</b></td>
85 <td>&nbsp;<b>Values</b></td>
86 <td>&nbsp;<b>Description</b></td>
87 </tr>
88
89 <tr>
90 <td>&nbsp;<em>current-time</em></td>
91 <td>&nbsp;DDD MMM dd hh:mm:ss YYYY</td>
92 <td>&nbsp;Current <b>local</b> time at the time of transfer</td>
93 </tr>
94
95 <tr>
96 <td>&nbsp;<em>transfer-time</em></td>
97 <td>&nbsp;Seconds</td>
98 <td>&nbsp;Total time in <b>seconds</b> for the transfer</td>
99 </tr>
100
101 <tr>
102 <td>&nbsp;<em>remote-host</em></td>
103 <td>&nbsp;String</td>
104 <td>&nbsp;Remote client DNS name (or IP address)</td>
105 </tr>
106
107 <tr>
108 <td>&nbsp;<em>file-size</em></td>
109 <td>&nbsp;Bytes</td>
110 <td>&nbsp;Number of bytes transferred</td>
111 </tr>
112
113 <tr>
114 <td>&nbsp;<em>filename</em></td>
115 <td>&nbsp;String</td>
116 <td>&nbsp;Name of the transferred file</td>
117 </tr>
118
119 <tr>
120 <td>&nbsp;<em>transfer-type</em></td>
121 <td>&nbsp;Flags</td>
122 <td>&nbsp;Indicates whether the transfer was an ASCII (<code>"a"</code>) or
123 binary (<code>"b"</code>) transfer</td>
124 </tr>
125
126 <tr>
127 <td>&nbsp;<em>special-action-flag</em></td>
128 <td>&nbsp;Flags</td>
129 <td>&nbsp;One or more single character indicating any special action taken: "C" (compressed), "U" (uncompressed), "T" (tarred), "_" (no action)</td>
130 </tr>
131
132 <tr>
133 <td>&nbsp;<em>direction</em></td>
134 <td>&nbsp;Flags</td>
135 <td>&nbsp;Direction of the transfer: "o" (outgoing, <i>i.e.</i> download), "i" (incoming, <i>i.e.</i> upload), "d" (deleted)</td>
136 </tr>
137
138 <tr>
139 <td>&nbsp;<em>access-mode</em></td>
140 <td>&nbsp;Flags</td>
141 <td>&nbsp;Method by which the user is logged in: "a" (anonymous), "g" (guest), "r" (real user)</td>
142 </tr>
143
144 <tr>
145 <td>&nbsp;<em>username</em></td>
146 <td>&nbsp;String</td>
147 <td>&nbsp;Authenticated username</td>
148 </tr>
149
150 <tr>
151 <td>&nbsp;<em>service-name</em></td>
152 <td>&nbsp;String</td>
153 <td>&nbsp;Name of the service used: "ftp", "sftp", "scp", <i>etc</i></td>
154 </tr>
155
156 <tr>
157 <td>&nbsp;<em>authentication-method</em></td>
158 <td>&nbsp;Flags</td>
159 <td>&nbsp;Method of authentication used: "0" (none), "1" (<a href="https://www.ietf.org/rfc/rfc1413.txt">RFC 1413</a>)</td>
160 </tr>
161
162 <tr>
163 <td>&nbsp;<em>authenticated-user-id</em></td>
164 <td>&nbsp;Flags</td>
165 <td>&nbsp;Name of user provided by RFC 1413 lookup, otherwise "*"</td>
166 </tr>
167
168 <tr>
169 <td>&nbsp;<em>completion-status</em></td>
170 <td>&nbsp;Flags</td>
171 <td>&nbsp;Single character indicating the status of the transfer: "c" (complete), "i" (incomplete)</td>
172 </tr>
173 </table>
174
175 <p>
176 <b>History of the <code>xferlog(5)</code> Format</b><br>
177 This xferlog(5) format seems a bit odd, right? To understand this, it helps
178 to keep in mind the history of this format. The xferlog(5) format
179 <b>predates</b> ProFTPD. The ProFTPD Project copied this format from
180 <a href="http://wu-ftpd.therockgarden.ca/man/xferlog.html">wu-ftpd</a>, which
181 was <em>the</em> popular FTP server at that time. There were already existing
182 tools/scripts which knew how to parse that format, so ProFTPD used it. Since
183 then, <code>wu-ftpd</code> has waned in maintenance and popularity; other
184 FTP servers (<i>e.g.</i> <code>pure-ftpd</code>, <code>vsftpd</code>, but
185 <b>not</b> the built-in <code>ftpd</code> on FreeBSD) have since then picked
186 up the <code>xferlog(5)</code> format from ProFTPD. Thus this log format has
187 a 20+ year history, and keeps going.
188
189 <p>
190 This history helps explain certain fields in the <code>xferlog(5)</code>
191 format, such as the <em>authentication-method</em> and
192 <em>authenticated-user-id</em> fields. These fields were more relevant in
193 the past, when the RFC 1413 Identd protocol was more widespread in use. Now,
194 <b>very</b> few sites run <code>identd</code> servers; these fields in the
195 log format are thus archaic. Thus in almost all ProFTPD-generated
196 <code>TransferLog</code> entries, <em>authentication-method</em> will be "0",
197 and <em>authenticated-user-id</em> will be "*".
198
199 <p>
200 Likewise, the <em>special-action-flags</em> field mentions "compressed" and
201 "uncompressed" files; these flags specifically refer to the
202 <a href="https://en.wikipedia.org/wiki/Compress"><code>compress</code></a>
203 Unix program, which used the ".Z" file extension. This compression utility
204 has been superseded with <i>e.g.</i> <code>gzip</code>, <code>bzip2</code>,
205 and others these days. Thus the <em>special-action-flags</em> field in
206 ProFTPD-generated <code>TransferLog</code> entries is almost always "_".
207
208 <p><a name="SystemLog"></a>
209 <b><i><code>SystemLog</code></i></b><br>
210 If the site administrator wants to have <code>proftpd</code> log its messages
211 to a file rather than going through <code>syslogd</code>, the
212 <a href="../modules/mod_log.html#SystemLog"><code>SystemLog</code></a>
213 configuration directive is the one to use. There is only one such file kept
214 for the entire daemon. See the
215 <a href="../modules/mod_log.html#ServerLog"><code>ServerLog</code></a>
216 directive for keeping a similar log on a per-vhost basis. Note that the
217 <a href="../modules/mod_core.html#DebugLevel"><code>DebugLevel</code></a>
218 directive only applies to <code>SystemLog</code> files; it does not materially
219 affect the syslog-based logging messages.
220
221 <p><a name="ExtendedLog"></a>
222 <b><i><code>ExtendedLog</code></i></b><br>
223 The <a href="../modules/mod_log.html#ExtendedLog"><code>ExtendedLog</code></a>
224 directive is used to create log files of a very flexible and configurable
225 format, and to have granular control over what is logged, and when. The format
226 of an <code>ExtendedLog</code> is described using the
227 <a href="../modules/mod_log.html#LogFormat">LogFormat</a> directive.
228 Multiple <code>ExtendedLogs</code> can be configured, each with a different
229 <code>LogFormat</code>.
230
231 <!-- Add note/chunk about FTP response codes, from RFC959, for ExtendedLog? -->
232
233 <p><a name="SyslogVSFileLog"></a>
234 <b>Use of <code>syslog</code> versus file logging</b><br>
235 Most sites will choose to have <code>proftpd</code> log via syslog (which is
236 the default) or to a file (via the <code>SystemLog</code> directive). In
237 either case, there is the question of logging <i>verbosity</i>, <i>i.e.</i>
238 which messages to log. This verbosity is determined by the
239 <a href="../modules/mod_core.html#SyslogLevel"><code>SyslogLevel</code></a>
240 directive. ProFTPD will log everything by default, meaning that the default
241 <code>SyslogLevel</code> is effectively <code>debug</code>. If, however, you
242 have your <code>proftpd</code> configured to log via syslog, then you
243 <i>should</i> also check your <code>/etc/syslog.conf</code> file, to see what
244 additional filtering of log messages is being applied by syslog. For example,
245 if <code>/etc/syslog.conf</code> contained something like:
246 <pre>
247 # Log anything (except mail) of level info or higher.
248 *.info;mail.none;authpriv.none;cron.none /var/log/messages
249 </pre>
250 then ProFTPD's log messages below the <code>info</code> level would be filtered
251 out <b>by syslog</b>. When you are using syslog logging, the
252 <code>SyslogLevel</code> configuration directive applies only to the proftpd
253 logging, and does not control the additional syslog filtering.
254
255 <p>
256 For finer-grained control of the <code>debug</code> level log messages, ProFTPD
257 internally implements different levels for its <code>debug</code> log messages.
258 Currently ProFTPD has level 1 through level 10 <code>debug</code> messages.
259 The <a href="../modules/mod_core.html#DebugLevel"><code>DebugLevel</code></a>
260 directive is used control the verbosity/filtering of these messages. Since
261 these different debug levels are purely a ProFTPD convention, the
262 <code>DebugLevel</code> directive has no effect on syslog logging. Also, if
263 your <code>SyslogLevel</code> configuration uses a level higher than
264 <code>debug</code>, then the <code>DebugLevel</code> configuration will have
265 no effect &mdash; your <code>debug</code> level messages are already filtered
266 out by the <code>SyslogLevel</code> filtering.
267
268 <p>
269 The last point to mention is that the
270 <a href="../modules/mod_core.html#SyslogFacility"><code>SyslogFacility</code></a> directive only applies to syslog logging; it has no effect on file logging.
271
272 <p><a name="LogAnalysis"></a>
273 <b>Log Analysis</b><br>
274 There are a variety of log analyzers available; these are just a few:
275 <ul>
276 <li>Webalizer: <a href="http://www.webalizer.org/">http://www.webalizer.org/</a>
277 <li>HTTP-analyze: <a href="http://www.netstore.de/Supply/http-analyze/">http://www.netstore.de/Supply/http-analyze/</a>
278 <li>Report Magic: <a href="http://www.reportmagic.org/">http://www.reportmagic.org/</a>
279 <li>FTPWeblog: <a href="http://www.nihongo.org/snowhare/utilities/ftpweblog/">http://www.nihongo.org/snowhare/utilities/ftpweblog/</a>
280 </ul>
281
282 <p><a name="LogRotation"></a>
283 <b>Log Rotation</b><br>
284 On even a moderately busy server, the quantity of information stored in the log
285 files is very large. It will consequently be necessary to periodically rotate
286 the log files by moving or deleting the existing logs. This cannot be done
287 while the processes are running, because the processes will continue writing to
288 the old log file as long as they hold the file open. Instead, the server must
289 be <a href="Stopping.html">restarted</a> after the log files are moved or
290 deleted so that the processes will open new log files.
291
292 <p>
293 The <code>SIGHUP</code> signal, for restarting ProFTPD, goes to the "master"
294 daemon process, the process that is listening for new connections. Whenever a
295 new connection is received, the daemon process forks off a <i>separate new session process</i> which handles that connection, including logging for that
296 session.
297
298 <p>
299 Part of handling of a session often involves handling the
300 <code>DefaultRoot</code> directive, which uses the <code>chroot(2)</code>
301 function to restrict the session process. This means, in practice, that once
302 the process is chrooted, it <b>cannot</b> re-open the configured log files
303 anymore, as those log paths are not located within the restricted portion of
304 the filesystem.
305
306 <p>
307 This means that any log rotation will need to handle the case where existing
308 session processes continue writing to the old log files, until those sessions
309 complete. If one is using <code>logrotate</code>, for example, this means
310 using the <code>copytruncate</code> and/or <code>delaycompress</code> settings.
311
312 <p>
313 Another way to perform log rotation is using <a href="#FIFOs">FIFOs</a> as
314 discussed in the next section.
315
316 <p><a name="FIFOs"></a>
317 <b>FIFOs (<i>a.k.a.</i> named pipes)</b><br>
318 ProFTPD is capable of writing log files to FIFOs, from which another
319 process can read. Use of this capability dramatically increases the
320 flexibility of logging, without adding code to the main server. In order to
321 write logs to a pipe, simply create the FIFO at the desired path
322 (<code>man mkfifo(1)</code>), and use that path in the logging configuration
323 directive.
324
325 <p>
326 One important use of piped logs is to allow log rotation without having to
327 restart the server. One such popular flexible log rotation program is
328 <a href="http://www.ford-mason.co.uk/resources/cronolog/">cronolog</a>;
329 however, at present cronolog requires a small patch to enable it to read
330 from a FIFO (by default, cronolog reads data from stdin). Please contact
331 the author of this article for details concerning the patch.
332
333 <p>
334 Here's an example of FIFO-based logging script, based on one posted by Michael
335 Renner:
336 <pre>
337 #!/usr/bin/perl
338
339 use strict;
340
341 use File::Basename qw(basename);
342 use Sys::Syslog qw(:DEFAULT setlogsock);
343
344 my $program = basename($0);
345
346 my $fifo = '/var/log/proftpd-log.fifo';
347 my $syslog_facility = 'daemon';
348 my $syslog_level = 'info';
349
350 open(FIFO, "&lt; $fifo") or die "$program: unable to open $fifo: $!\n";
351
352 setlogsock 'unix';
353
354 openlog($program, 'pid', $syslog_facility);
355 syslog($syslog_level, $_) while (&lt;FIFO&gt;);
356 closelog();
357
358 close(FIFO);
359 exit 0;
360 </pre>
361 More complex filtering can be added to such scripts.
362
363 <p>
364 If using FIFOs, there are some caveats to keep in mind. If you use in
365 <code>init.d</code> script to start <code>standalone</code> daemons, you can
366 add commands to start the FIFO logging programs first, before the daemon.
367 For <code>inetd</code>-run servers, consider wrapping up the necessary
368 commands for starting a FIFO reader and the server into a simple shell
369 script, or simply run the FIFO-reading program from an <code>init.d</code>
370 script, and save the overhead of starting that process, in addition to the
371 <code>proftpd</code> process, for each FTP session.
372
373 <p>
374 FIFO-based log readers are a very powerful tool, but they should not be
375 used where a simpler solution like off-line post-processing is available.
376
377 <p>
378 <b>Note</b>: In ProFTPD 1.3.3, the code was changed to use nonblocking
379 <code>open(2)</code> system calls when opening log files. This was done to
380 prevent a <code>proftpd</code> process from blocking indefinitely
381 (<i>i.e.</i> "hanging") if the log file was a FIFO, and there was no FIFO
382 reader process running when the log file was opened. However, some sites
383 <i>do</i> want this blocking open behavior, as their FIFO reader processes
384 may be temporarily busy. To get the pre-1.3.3 blocking behavior, you will
385 need to compile proftpd using the <code>--disable-nonblocking-log-open</code>
386 configure option.
387
388 <p><a name="SQLLogging"></a>
389 <b>SQL Logging</b><br>
390 The <code>mod_sql</code> module also enables some powerful and complex
391 logging capabilities...
392
393 <p><a name="TraceLogging"></a>
394 <b>Trace Logging</b><br>
395 ProFTPD also supports a much more verbose form of logging called "trace
396 logging". This form of logging is covered in greater detail
397 <a href="Tracing.html">here</a>.
398
399 <p><a name="PidFile"></a>
400 <b>Pid File</b><br>
401 On startup, <code>proftpd</code> saves the process ID of the parent daemon
402 process to the file <code>var/proftpd/proftpd.pid</code>. This filename can be
403 changed with the <a href="../modules/mod_core.html#PidFile"><code>PidFile</code></a> directive. The process ID (<i>aka</i> PID) is for use by the administrator
404 in restarting and terminating the daemon by sending signals to the parent
405 process. For more information see the <a href="Stopping.html">stopping and
406 starting</a> page.
407
408 <p>
409 <b>Scoreboard File</b><br>
410 The last type of &quot;logging&quot; is done via the scoreboard file. The
411 scoreboard is binary-formatted file the server uses to store information
412 about each session; it is this file that is read by <code>ftptop</code>,
413 <code>ftpwho</code> and <code>ftpcount</code>. The location for the
414 scoreboard file is determined by the
415 <a href="../modules/mod_core.html#ScoreboardFile"><code>ScoreboardFile</code></a> directive.
416
417 <p><a name="FAQ"></a>
418 <b>Frequently Asked Questions</b><br>
419
420 <p>
421 <font color=red>Question</font>: How can I direct the <code>TransferLog</code>
422 logging to syslog?<br>
423 <font color=blue>Answer</font>: It is not currently possible to configure
424 proftpd to log <code>TransferLog</code> data to syslog. <b>However</b>, you
425 <i>can</i> configure an <code>ExtendedLog</code> which logs to syslog, and
426 which uses a <code>LogFormat</code> to log the data you wish. For example:
427 <pre>
428 LogFormat xfer "%h %l %u %t\"%r\" %s %b"
429 ExtendedLog syslog:notice xfer
430 </pre>
431 tells proftpd to log that <code>LogFormat</code> via syslog at the "notice"
432 syslog level.
433
434 <p>
435 <font color=red>Question</font>: I have <code>SystemLog</code> in my
436 <code>proftpd.conf</code>, and when I use the <code>SyslogLevel</code> directive
437 to try to filter the messages which <code>proftpd</code> logs to my
438 <code>SystemLog</code>, it doesn't work. Why not?<br>
439 <font color=blue>Answer</font>: When ProFTPD is configured to log everything
440 to a file via the <code>SystemLog</code> directive, it will do just that:
441 log <i>everything</i>, without any filtering, regardless of any
442 <code>SyslogLevel</code> directive. <b>However</b>, this changed in
443 ProFTPD 1.3.4rc1: in that release, the <code>SyslogLevel</code> directive was
444 made to apply to file-based logging as well.
445
446 <p>
447 <font color=red>Question</font>: I configured my <code>ExtendedLog</code>
448 directive (or <code>SystemLog</code>, or other logs) to point to a FIFO.
449 The FIFO path exists. But when I try to start <code>proftpd</code>, it
450 fails to start with this error:
451 <pre>
452 unable to open ExtendedLog '/path/to/extlog.fifo': No such device or address
453 </pre>
454 Shouldn't this work?<br>
455 <font color=blue>Answer</font>: The "No such device or address" error occurs
456 when you configure <code>proftpd</code> to log to a FIFO, <b>and</b> the
457 FIFO reader process has not yet been started. In times past,
458 <code>proftpd</code> would wait indefinitely on startup, waiting for the FIFO
459 reader process to start; now, <code>proftpd</code> tries to open the FIFO
460 in a nonblocking mode, so that it can fail immediately if there is no process
461 on the other end of the FIFO.
462
463 <p>
464 The "fix" is to make sure that any FIFO reader processes are started
465 <i>before</i> starting <code>proftpd</code>.
466
467 <p>
468 <font color=red>Question</font>: How can I configure <code>proftpd</code> so
469 that <b>nothing</b> is logged for certain clients/IP addresses?<br>
470 <font color=blue>Answer</font>: Using a combination of <a href="Classes.html">classes</a> and the <a href="../contrib/mod_ifsession.html"><code>mod_ifsession</code></a> module, this can be done using a configuration like this:
471 <pre>
472 &lt;Class invisible&gt;
473 From 1.2.3.4
474 &lt;/Class&gt;
475
476 &lt;IfClass invisible&gt;
477 # Disable all logging of these clients
478 SystemLog none
479 ExtendedLog /path/to/ext.log NONE
480 TransferLog none
481 &lt;/IfClass&gt;
482 </pre>
483
484 <p>
485 <font color=red>Question</font>: How can I configure <code>proftpd</code> so
486 that it does <em>no logging at all</em>? I have a very small embedded system
487 for development/testing, and so do not need or want the logging.<br>
488 <font color=blue>Answer</font>: To do this, you will need to disable much
489 of the builtin, default logging that <code>proftpd</code> does, <i>e.g.</i>:
490 <pre>
491 # Discard the normal logging
492 SystemLog none
493
494 # Disable xferlog(5) logging
495 TransferLog none
496
497 # Disable logging to b/u/wtmp files
498 WtmpLog off
499 </pre>
500 In addition, you may need to go through your <code>proftpd.conf</code> file
501 (as well as any <code>Include</code> config files), and remove all
502 <code>ExtendedLog</code> and <code>TraceLog</code> directives. Also remove
503 any per-module <code><i>*</i>Log</code> directives like <code>BanLog</code>,
504 <code>SFTPLog</code>, <code>SQLLogFile</code>, <code>TLSLog</code>, <i>etc</i>.
505
506 <p>
507 You might be tempted to symlink the log files configured to
508 <code>/dev/null</code>, rather than changing the <code>proftpd.conf</code>.
509 This approach can work, <b><i>if you also use the <code>AllowLogSymlinks</code> directive</i></b>, <i>i.e.</i>:
510 <pre>
511 # Allow proftpd to write logs to symlinks; note that this is insecure,
512 # as the symlinks might be changed to point to other files such that
513 # proftpd will overwrite them.
514 AllowLogSymlinks on
515 </pre>
516
517 <p>
518 <font color=red>Question</font>: I see:
519 <pre>
520 wtmp /var/log/wtmp: No such file or directory
521 </pre>
522 in my logs. What is <code>WtmpLog</code> logging? The description in the
523 documentation is quite vague.<br>
524 <font color=blue>Answer</font>: The <code>wtmp</code> logging support is
525 <b>not</b> specific to <code>proftpd</code>, and instead is a more general Unix
526 facility; this is why the ProFTPD documentation does not cover it in great
527 detail. To learn more about <code>wtmp</code> (or any of its other
528 incarnations: <code>wtmpx</code>, <code>utmp</code>, <code>utmpx</code>),
529 please find their related man pages.
530
531 <p>
532 Now to make the "No such file or directory" log message go away, simply tell
533 <code>proftpd</code> to stop trying to use <code>wtmp</code> logging by using
534 the <a href="../modules/mod_auth.html#WtmpLog"><code>WtmpLog</code></a>
535 directive:
536 <pre>
537 WtmpLog off
538 </pre>
539 in your <code>proftpd.conf</code>.
540
541 <p>
542 <font color=red>Question</font>: I usually run in a non-English locale; my
543 ProFTPD version is older than 1.3.6, <i>and</i> I use <code>fail2ban</code>.
544 Unfortunately, <code>fail2ban</code> has trouble with the non-English
545 localized dates in the syslog messages, <i>e.g.</i>:
546 <pre>
547 juil. 28 16:42:17 server-hostname proftpd[9423] server-hostname ...
548 </pre>
549 in my logs. How can I get ProFTPD to log using the English locale, for
550 working with <code>fail2ban</code> properly?<br>
551 <font color=blue>Answer</font>: The locale-related environment variable which
552 governs how dates are formatted is the <code>LC_TIME</code> environment
553 variable. Thus you need to set that environment variable, <em>before</em>
554 ProFTPD is started, to use the English locale if you want English localization,
555 <i>e.g.</i>:
556 <pre>
557 $ export LC_TIME=en_US.UTF-8
558 $ service proftpd start
559 </pre>
560 Note that the above is only really needed due to the older version of ProFTPD.
561
562 <p>
563 In later version of ProFTPD, the syslog logging format changed (to avoid such
564 localization issues), so that it now looks like:
565 <pre>
566 2017-07-28 16:42:17 server-hostname proftpd[9423] server-hostname ...
567 </pre>
568 This should help many such log-parsing issues.
569
570 <p>
571 <hr>
572 <font size=2><b><i>
573 &copy; Copyright 2017-2024 The ProFTPD Project<br>
574 All Rights Reserved<br>
575 </i></b></font>
576 <hr>
577
578 </body>
579 </html>