Home Back to Tutorial Online Help

Write file transfer log to database through ODBC

Xlight FTP Server can write file transfer log to database through ODBC.

In this example, we use MySQL database to demonstrate the procedure of writing file transfer log to database. Note: after 30-day evaluation period, this function is only supported by the Professional edition of Xlight FTP Server.

To write file transfer log to database through ODBC, you need to configure ODBC data source first.

1. Download MySQL ODBC data source driver from http://www.mysql.com/downloads/api-myodbc.html and install MySQL Data Source Driver in the machine running Xlight FTP Server.

2. Go to "Control Panel->Administrative tools->Data Sources (ODBC)"; select the "System DSN" tab.

3. Click "Add..." button, select "MySQL ODBC 3.51 Driver" and click the "Finish" button.

4. In this example, we use "File Transfer Log" as the name of data source. File transfer log can use different database and ODBC data source from Xlight FTP Server user database. It is suggested to use different database for users and file transfer log for better performance.


5. You need to enable logging to database in "Global Options->Log->File Transfer Log - Logging to Database".


6. You have to setup data source name and database user and password as showed in the figure below. You can click the "Create" button to let Xlight FTP Server create table needed in the database. You can also click the "Test" button to check if you have the correct table in the database.


After above setup, you should be able to log file transfer to database now.

transfer_log_table structure

Database Column nameData TypeDescription
finish_timevarchar(24)File transfer finished time.
directionintegerThe direction of file transfer. 0 - file download, 1 - file upload.
file_namevarchar(255)Name of file.
file_pathvarchar(255)FTP Path, where file is located.
transfer_bytesdoubleTransfered bytes for this file.
starting_offsetdoubleFile transfer starting offset.
transfer_timefloatTotal file transferring time in seconds
transfer_statusintegerTh status of file transfer. 0 - success, 1 -failure
usernamevarchar(65)The name of user who transferred the file.
client_ipvarchar(65)The IP address of this user
server_ipvarchar(65)The IP address of this virtual server
server_portintegerThe port of this virtual server