Title: clear logs
Last modified: June 20, 2018

---

# clear logs

 *  [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/)
 * Hi ithemes,
 * Looking at my global setting, i have set Days to Keep Database Logs as 3 days.
   However looking at my database, my log file has capture data up to 2 months ago.
   I am wondering is it a bug or conflict with plugin/server/disabling wp-cron that
   cause logs not clearing?
 * thanks

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

 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10417395)
 * Add the line below to the wp-config.php file:
 * `define(‘ITSEC_DEBUG’, true);`
 * This will add an extra menu option to the Security menu named Debug.
    Navigate
   to the Security->Debug menu option.
 * Copy/paste the ### iThemes Security ### section from the **System Info** window
   into this topic.
    -  This reply was modified 8 years ago by [nlpro](https://wordpress.org/support/users/nlpro/).
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10417713)
 * Hi nlpro,
 * After adding the codes you gave me, i couldn’t find the debug menu option.
    Does
   it applies to itheme pro? because i’m using the free version downloaded via wordpress
   plugin.
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10417840)
 * No, it works fine with the free plugin.
 * You have probably made some error adding it to the wp-config.php file.
 * If you have copy/pasted the line from my previous post, try adding it by typing
   it manually. The single quotes used in my previous post may be a problem.
 * Also make sure to add the line in the correct location in the wp-config.php file.
   It must be added **before** the line below:
 * `/* That's all, stop editing! Happy blogging. */`
 * Oops, almost forgot to mention that the extra debug page is only available as
   of the 7.0.2 or newer release of the plugin 😉
    -  This reply was modified 8 years ago by [nlpro](https://wordpress.org/support/users/nlpro/).
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10421316)
 * Hi,
 * Sorry for the late reply. I added the codes into the wp-config.php just before
   the the line you mention, however i still do not see the Debug menu at Security
   >Debug.
 * Here’s the image i’m looking at: [https://ibb.co/gBsOvT](https://ibb.co/gBsOvT)
 * I could clear my log under my database but that would not resolve the clear log
   every 3 days. I wonder what’s wrong.
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10421417)
 * No problem.
 * Weird, however I did notice there is a Plugin update (1) visible in your screenshot.
   
   Please make sure the iTSec plugin is updated to the latest release (7.0.3) 😉
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10421452)
 * my itsec plugin is the latest version 7.0.3, the plugin update is for my theme
   plugin which i have yet to download from my theme website.
 * Yup i agree, it’s weird that i do not see it for myself as well.
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [8 years ago](https://wordpress.org/support/topic/clear-logs-4/#post-10421535)
 * Ok, perhaps editing the wrong wp-config.php file ? (Getting desperate here …).
 * As a temporary workaround you can disable the ITSEC_DEBUG condition in the code.
   
   That way we simply force the extra Debug page to show up. The edit is perfectly
   save but will be undone with any new plugin update.
 * First make a backup copy of the better-wp-security/core/admin-pages/init.php 
   file.
 * Then edit the better-wp-security/core/admin-pages/init.php file and navigate 
   to lines 50-52:
 *     ```
       50		if ( defined( 'ITSEC_DEBUG' ) && ITSEC_DEBUG ) {
       51			$page_refs[] = add_submenu_page( 'itsec', __( 'iThemes Security Debug', 'better-wp-security' ), __( 'Debug' ), $capability, 'itsec-debug', array( $this, 'show_page' ) );
       52		}
       ```
   
 * Change it to look like this:
 *     ```
       50//		if ( defined( 'ITSEC_DEBUG' ) && ITSEC_DEBUG ) {
       51			$page_refs[] = add_submenu_page( 'itsec', __( 'iThemes Security Debug', 'better-wp-security' ), __( 'Debug' ), $capability, 'itsec-debug', array( $this, 'show_page' ) );
       52//		}
       ```
   
 * You only need to add 2 forward slashes at the beginning of lines 50 and 52.
    
   Save the changes.
 * Independent of the ITSEC_DEBUG constant being set or not the Debug menu option
   should now be available.
    -  This reply was modified 8 years ago by [nlpro](https://wordpress.org/support/users/nlpro/).
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10540919)
 * Turns out I did use incorrect quotes in my first post of this topic.
    Copy/paste
   may have caused your wp-config.php edit not to work as intended.
 * My apologies for the inconvenience.
 * Below the same entry with the right quotes:
 * `define('ITSEC_DEBUG', true);`
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10542422)
 * Hi there,
 * I implemented the entry and it works! I now have the debug menu.
 * Here’s what it shows from the ###itheme security###
 * ### iThemes Security ###
    Build: 4097 Pro: Modules: ban-users, backup, brute-
   force, network-brute-force, wordpress-tweaks, 404-detection, and system-tweaks
   Cron: 1 Cron Status: 1 Scheduler: ITSEC_Scheduler_Cron
 * Currently, my logs file has pile up to a month ago even though i set it at 2 
   days.
 * Thanks
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10542794)
 * Ah, great.
 * Ok, and what’s displayed under the **Scheduler** section ?
 * That’s the last info I’ll need in order to be able to diagnose your situation.
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10543776)
 * There’s nothing displayed in my scheduler. But now that i look at it, i suspect
   it may be that i disabled my wp-cron and from my hosting i have manually set 
   my cron job to every 30 minutes.
 * Anyway here’s the scheduler. There’s nothing displayed there except having ITSEC_Scheduler_Cron
   beside the reset button:
    [https://ibb.co/fj1E18](https://ibb.co/fj1E18)
 * If it is due to the wp-cron disabled, how i manage to do it is through here:
   
   [https://www.siteground.com/tutorials/wordpress/real-cron-job/](https://www.siteground.com/tutorials/wordpress/real-cron-job/)
 * Thanks!
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10544503)
 * The way the iTSec plugins hooks into WP Cron makes how WP Cron is invoked irrelevant.
   We can actually use your situation to prove that.
 * Normally there are 3 maintenance cron jobs (purge-log-entries, clear-locks and
   purge-lockouts) created by the iTSec plugin. Due to a plugin bug these are sometimes
   missing, as seems to be the case in your env. They may have existed for a short
   while but due to a plugin bug the 3 maintenance cron jobs run the risk of getting
   deleted by the plugin …
 * In order to get the iTSec plugin to create (and more importantly persist) those
   3 maintenance cron jobs try this:
 * 1. Add the following **MANDATORY** (but pretty much undocumented) entry to your
   wp-config.php file:
 * `define('ITSEC_USE_CRON', true);`
 * 2. Refresh the plugin Debug page and then recheck the **Scheduler** section. 
   If the 3 maintenance cron jobs are listed the iTSec plugin is now properly hooking
   into WP Cron. From now on the **purge-log-entries** cron job will take care of
   maintaining how much data is stored in the logs table of the database.
 * If the 3 maintenance cron jobs are still not listed, simply deactivate the plugin
   and then reactivate it. Now revisit the plugin Debug page and then recheck the**
   Scheduler** section. If I’m correct you should now see the 3 cron jobs listed.
 * Adding the recommended line to the wp-config.php file is vital in ensuring that
   the iTSec plugin hooks properly into WP Cron AND persists doing so in the future.
 *  [nlpro](https://wordpress.org/support/users/nlpro/)
 * (@nlpro)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10547413)
 * 2 things I want to add:
 * The iTSec plugin doesn’t delete the maintenance cron jobs (unless you deactivate
   or uninstall the plugin). I just realised I didn’t formulate that properly in
   my previous post. Once a cron job executes it’s always deleted (by WP Cron) and
   a new cron job is then scheduled.
    The bug in the iTSec plugin will under certain
   specific circumstances prevent the maintenance cron jobs from being rescheduled(
   daily).
 * Once you set the ITSEC_USE_CRON constant to true in the wp-config.php file you
   may notice when looking at the ### iThemes Security ### section of System Info
   that it’s being reported as “Disabled”.
    Ignore that. It’s a bug in the code 
   of the Debug page.
 *  Thread Starter [xeith](https://wordpress.org/support/users/xeith/)
 * (@xeith)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10547733)
 * Hi there,
 * I input the entry into my wp-config and got it working. I see the 3 cron job 
   being active and ran it. It works! Thanks there. I taken note of the bug in the
   code of the debug page.
 * Thanks!

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

The topic ‘clear logs’ is closed to new replies.

 * ![](https://ps.w.org/better-wp-security/assets/icon.svg?rev=3529351)
 * [Kadence Security – Password, Two Factor Authentication, and Brute Force Protection](https://wordpress.org/plugins/better-wp-security/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/better-wp-security/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/better-wp-security/)
 * [Active Topics](https://wordpress.org/support/plugin/better-wp-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/better-wp-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/better-wp-security/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [xeith](https://wordpress.org/support/users/xeith/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/clear-logs-4/#post-10547733)
 * Status: not resolved