Home Back to Tutorial Online Help

Write file transfer log to the database through ODBC

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

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

To write a file transfer log to the database through ODBC, you need to configure the 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 the "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 the data source. File transfer logs can use different databases and ODBC data sources from the Xlight FTP Server user database. It is suggested to use different databases for users and file transfer logs for better performance.


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


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


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

transfer_log_table structure

Database Column nameData TypeDescription
finish_timevarchar(24)File transfer finished time.
directionintegerThe direction of the file transfer. 0 - file download, 1 - file upload.
file_namevarchar(255)Name of file.
file_pathvarchar(255)FTP Path, where the file is located.
transfer_bytesdoubleTransferred 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 the 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