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 name | Data Type | Description |
---|---|---|
finish_time | varchar(24) | File transfer finished time. |
direction | integer | The direction of file transfer. 0 - file download, 1 - file upload. |
file_name | varchar(255) | Name of file. |
file_path | varchar(255) | FTP Path, where file is located. |
transfer_bytes | double | Transfered 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 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 |