Title: Export ip address in csv
Last modified: March 15, 2019

---

# Export ip address in csv

 *  Resolved [golded](https://wordpress.org/support/users/golded/)
 * (@golded)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/export-ip-address-in-csv/)
 * Hey,
 * I would to know how to export all ip by date for example in a csv file.
 * I notice for you information, there is a bug when we want filter by date > it
   appears “no data”.
 * Thanks !
 * Regards

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [wfdave](https://wordpress.org/support/users/wfdave/)
 * (@wfdave)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11319064)
 * Hi [@golded](https://wordpress.org/support/users/golded/),
 * There is no way to export CSV data within Wordfence.
 * However, I’ve written a query for you:
 *     ```
       SELECT INET6_NTOA(IP), ctime 
       FROM wp_wfhits 
       ORDER BY ctime DESC 
       INTO OUTFILE 'D:/output2.csv' 
       FIELDS TERMINATED BY ',' 
       ENCLOSED BY '"' 
       LINES TERMINATED BY '\n';
       ```
   
 * This will generate a CSV file named `/output.csv` that looks like this:
 *     ```
       "::1","1550651582.887000"
       "::1","1550651579.051000"
       "::1","1550651547.256000"
       ```
   
 * Where the first column is the IP address, and the second is the unix timestamp.
   The rows are sorted from most recent to the oldest.
 * —
 * Can you explain what is wrong with the filtering? Note that you need to choose
   the correct time zone for the From and To filtering.
 * For example: [https://i.imgur.com/9gZrC9S.png](https://i.imgur.com/9gZrC9S.png)
 * Dave
 *  Thread Starter [golded](https://wordpress.org/support/users/golded/)
 * (@golded)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11319498)
 * hi,
 * thanks you for the query but how can i use it ?
 * —
 * Concerning filter according a date, it’s written “No requests to report yet.”
 * for example :
    [https://drive.google.com/file/d/116-G3w7T7DWpaQ5ijlol0nxD9nJypuMn/view?usp=sharing](https://drive.google.com/file/d/116-G3w7T7DWpaQ5ijlol0nxD9nJypuMn/view?usp=sharing)
 * But in reality, there are so many data…
 * Regards
 *  [wfdave](https://wordpress.org/support/users/wfdave/)
 * (@wfdave)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11319783)
 * Hi again,
 * To use that query, you can use SSH to connect to your host, and then run that
   query on your database. (Alternatively, you can use the PHPMyAdmin to run SQL)
 * Regarding the date filter, you need to set `To:` to a later date then `From:`.
 * For example:
 * From: 03/12/2019 1:00pm
    To: 03/12/2019 6:00pm
 * This will select the data from 1:00pm to 6:00pm.
 * If you have From and To the same, then it won’t select any data because there
   is no range to select.
 * Dave
 *  Thread Starter [golded](https://wordpress.org/support/users/golded/)
 * (@golded)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11320468)
 * hi,
 * oh ok, i didn’t notice “time”. thank you so much !
 * have a good day
 *  Thread Starter [golded](https://wordpress.org/support/users/golded/)
 * (@golded)
 * [7 years ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11487948)
 * hi,
 * I just tried to excecute you query but there is an error :
 * “Error
    Static analysis:
 * 1 errors were found during analysis.
 * Unexpected ordering of clauses. (near “FROM” at position 31)
    SQL query: Documentation
 * SELECT INET6_NTOA(IP), ctime FROM wp_wfhits ORDER BY ctime DESC INTO OUTFILE ‘
   D:/output2.csv’ FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\
   n’
 * MySQL said: Documentation
 * #1045 – Access denied for user ‘***namedatabase***’@’%’ (using password: YES)”
 * —
 * query :
    SELECT INET6_NTOA(IP), ctime FROM wp_wfhits ORDER BY ctime DESC INTO
   OUTFILE ‘D:/output2.csv’ FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED
   BY ‘\n’;
 * Cold you help me ?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Export ip address in csv’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

## Tags

 * [address](https://wordpress.org/support/topic-tag/address/)
 * [IP](https://wordpress.org/support/topic-tag/ip/)

 * 5 replies
 * 2 participants
 * Last reply from: [golded](https://wordpress.org/support/users/golded/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/export-ip-address-in-csv/#post-11487948)
 * Status: resolved