User Tools

Site Tools


software:wordpress:cleanlog

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

software:wordpress:cleanlog [2024/04/05 17:48] – created rodolicosoftware:wordpress:cleanlog [2024/04/05 18:51] (current) rodolico
Line 1: Line 1:
 ====== Clean WordPress Security Logs ====== ====== Clean WordPress Security Logs ======
  
-WordPress has some big security issues which, if not managed correctly+WordPress has some big security issues which, if not managed correctly. We use [https://ithemes.com/security|iThemes Security Pro] which allows us to lock down access to our sites and block most (or all) hacking/cracking attempts. 
 + 
 +However, the logs are only stored in the database and no longer able to be cleaned automatically, so two tables (wp_itsec_logs,wp_itsec_lockouts) in each database grow without limits. The first (logs) was over 500k rows when I went to investigate what was using all of our disk space. 
 + 
 +To fix this, I wrote a simple Perl script that is run weekly as a cron job, removing anything older than 4 weeks. When I ran this the first time, on a system which has just grown over the years, I removed almost 2 Gigabytes from the half dozen sites that were affected. 
 + 
 +This script can be downloaded from our Subversion repository with the command <code bash>svn co http://svn.dailydata.net/svn/sysadmin_scripts/trunk/Wordpress/cleanWPSecLogs</code>. Note: this is our working site, and we will make updates and changes without warning, but since we use this for our stuff, we try to not break things! Or, you can simply download the file here.
  
 <code perl cleanWPSecLogs> <code perl cleanWPSecLogs>
Line 24: Line 30:
 # Description # Description
 # Script to clean up security log tables on WordPress sites # Script to clean up security log tables on WordPress sites
-# Some wordpress site security suites continously add logs, but do not offer the ability to clean up entries after+# Some WordPress site security suites continuously add logs, but do not offer the ability to clean up entries after
 # a certain period of time. This can cause database tables to grow without relief until they threaten to fill # a certain period of time. This can cause database tables to grow without relief until they threaten to fill
 # the database partition # the database partition
software/wordpress/cleanlog.txt · Last modified: 2024/04/05 18:51 by rodolico