OK, so the first step is set you your database.
You will need three columns: ID, date, and IP.
the id is the primary key with auto increment, and date is a timestamp and set the default to CURRENT_TIMESTAMP, and the ip is a varchar 250.
Next, you will then add the DataAssist Server Behavior, and after you select you table on step 2 when you bind the values, leave the id and date blank and for the IP, set the value to:
$_SERVER['REMOTE_ADDR'];
This will store the needed information in your database. As far as saving the data to a text file, i think that would require a little bit of work and some custom coding, but here is a link that could help you get started
file_write_php.htm