# Stock ftpd(8) logging



## PacketMan (Nov 7, 2018)

I am using ftpd(8) so that another device can dump some files into my FreeBSD home server.  According to the handbook, ftp logging should be written to /var/log/xferlog but I see now that file on my machine is empty. There is one line only in it, saying newsyslog first created the log file.

How do I change the logging so that any ftp activity on my machine is logged? I'm guessing I have to make a change to /etc/syslog.conf but its not clear to me what exactly I need to do.  My ftp logging level is still at the default of ftp.info which is the lowest you can go, minus debug, right? And I see my stock configurtation syslogd running on my machine, and I know a bunch of other logging is working.

What am I missing?


----------



## pkc (Nov 7, 2018)

I really don't know but I saw this on the sidebar, I guess you have already tried the `-l`, or `-ll` options?


----------



## ShelLuser (Nov 7, 2018)

PacketMan said:


> I am using ftpd(8) so that another device can dump some files into my FreeBSD home server.


Can you share the option(s) which you set up in /etc/rc.conf to use ftpd?

This is of course assuming that you're using rc.conf and not inetd, if you use the latter I'd like to see the entry in /etc/inetd.conf.

Either way, other than the settings mentioned above it also depends on your /etc/syslog.conf. You need at least this line:

```
ftp.info                                        /var/log/xferlog
```
Make sure you didn't grab any other ftp facilities (ftp.*) or wildcard info levels (*.info) because that could also influence this entry (if they're added before this line).


----------



## PacketMan (Nov 7, 2018)

My settings are stock, no changes made, thus this is the only entry  in /etc/rc.conf:
ftpd_enable="YES"

The handbook page for FTP does not mention inetd(8) and only mentions /etc/rc.conf.

So in /etc/inetd.conf  we have:
#ftp    stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -l
#ftp    stream  tcp6    nowait  root    /usr/libexec/ftpd       ftpd -l

And in /etc/syslog.conf we have:
ftp.info                                        /var/log/xferlog


----------



## ShelLuser (Nov 7, 2018)

PacketMan said:


> My settings are/were stock, no changes made, thus no entries in /etc/rc.conf.  The handbook page for FTP does not mention inetd(8) and only mentions /etc/rc.conf.


That seems a little contradictive   If you didn't change /etc/rc.conf then how did you set up ftpd?

Anyway, it's best to follow the instructions in chapter 29.9 of the handbook: enable FTPd in /etc/rc.conf, start the service and then it should start logging through syslog by default.

For what's it worth this is how I use it on my server:


```
breve:/home/peter $ grep ftp /etc/rc.conf
ftpd_enable="YES"
ftpd_flags="-4BMh"
```
You can find more about the available FTPd parameters ("flags") by looking through ftpd(8), and you can find all the options available for usage in /etc/rc.conf by checking up on /etc/defaults/rc.conf, just search for ftpd and you should be good.


----------



## Emrion (Nov 7, 2018)

To see some logs, you have to specify `ftpd_flags="-l"` in rc.conf. More options in  ftpd(8) of course. That's the way you set option(s) to fptd if it is started in rc.conf (as *ShelLuser *mentions in his example).


----------



## PacketMan (Nov 7, 2018)

Arrrrgh flags it was.  I used 
	
	



```
ftpd_flags="-ll"
```
 as I want more logging, at least for now.  In the FTP section in the handbook there is no mention of setting flags. Would be nice if it did.  In fact, I would be willing to add a line in there if I were a Handbook admin.  Its time for me to start contributing more to FreeBSD.  If someone were to send me some contact info for a few of the Handbook admins I will write them and gladly introduce myself.

Thanks again guys!


----------



## SirDice (Nov 7, 2018)

PacketMan said:


> In the FTP section in the handbook there is no mention of setting flags. Would be nice if it did. In fact, I would be willing to had a line in there if I were a Handbook admin.


Sometimes the only documentation is the actual scripts themselves. If you're looking for ways to configure certain services it always pays to look at the actual rc(8) scripts, /etc/rc.d/ftpd in this case. The *_flags variable is something that's standard for most scripts, have a look at rc.subr(8) for a few more. 


```
${name}_flags
                               Arguments to call command with.  This is
                               usually set in rc.conf(5), and not in the
                               rc.d(8) script.  The environment variable
                               `flags' can be used to override this.
```


----------

