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 name | Data Type | Description |
---|---|---|
finish_time | varchar(24) | File transfer finished time. |
direction | integer | The direction of the file transfer. 0 - file download, 1 - file upload. |
file_name | varchar(255) | Name of file. |
file_path | varchar(255) | FTP Path, where the file is located. |
transfer_bytes | double | Transferred bytes for this file. |
starting_offset | double | File transfer starting offset. |
transfer_time | float | Total file transferring time in seconds |
transfer_status | integer | Th status of file transfer. 0 - success, 1 -failure |
username | varchar(65) | The name of the user who transferred the file. |
client_ip | varchar(65) | The IP address of this user |
server_ip | varchar(65) | The IP address of this virtual server |
server_port | integer | The port of this virtual server |