/ Published in: PHP
And a now, word on the log.php maintenance script that comes with Magento 1.4 which has one major shortcoming.
It doesn’t maintain your dataflow_batch_* tables, said tables have been seen hiding in the wild at over a Gigabyte in size.
php -f ./shell/log.php help gives you a listing of the various options
php -f ./shell/log.php status gives you a listing of the log tables, how many rows and the size of storage space contained in the tables and indexes.
php -f ./shell/log.php clean --days 15 will clear all but the last 15 days of log contents (minimum 1 day)
php -f ./shell/log.php clean clears everthing per your settings in system setups under log maintenance
It doesn’t maintain your dataflow_batch_* tables, said tables have been seen hiding in the wild at over a Gigabyte in size.
php -f ./shell/log.php help gives you a listing of the various options
php -f ./shell/log.php status gives you a listing of the log tables, how many rows and the size of storage space contained in the tables and indexes.
php -f ./shell/log.php clean --days 15 will clear all but the last 15 days of log contents (minimum 1 day)
php -f ./shell/log.php clean clears everthing per your settings in system setups under log maintenance
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /*************************************************** * Magento Log File Contents Monitor. GNU/GPL * provided without warranty or support ***************************************************/ /*********************** * Scan Magento local.xml file for connection information ***********************/ $tblprefix = $xml->global->resources->db->table_prefix; $dbhost = $xml->global->resources->default_setup->connection->host; $dbuser = $xml->global->resources->default_setup->connection->username; $dbpass = $xml->global->resources->default_setup->connection->password; $dbname = $xml->global->resources->default_setup->connection->dbname; 'dataflow_batch_export', 'dataflow_batch_import', 'log_customer', 'log_quote', 'log_summary', 'log_summary_type', 'log_url', 'log_url_info', 'log_visitor', 'log_visitor_info', 'log_visitor_online', 'report_event' ); } else { } /** Get current date, time, UTC and offset **/ /*********************** * Start HTML output ***********************/ echo "<html><head><title>Magento Log File Contents on " . $date . " " . $time . "</title> <meta http-equiv=\"refresh\" content=\"30\"> <style type=\"text/css\">html {width: 100%; font-family: Arial,Helvetica, sans-serif;} body {line-height:1.0em; font-size: 100%;} table {border-spacing: 1px;} th.stattitle {text-align: left; font-size: 100%; font-weight: bold; color: white; background-color: #101010;} th {text-align: center; font-size: 90%; font-weight: bold; padding: 5px; border-bottom: 1px solid black; border-left: 1px solid black; } td {font-size: 90%; padding: 4px; border-bottom: 1px solid black; border-left: 1px solid black;} </style> </head><body>"; /** Output title, connection info and cron job monitor runtime **/ echo "<h2>Magento Log File Contents Report</h2><h3>Connection: ".$dbuser."@".$dbhost." – Database: " . $dbname . "</h3>"; echo "<h3>Runtime: " . $date . " " .$time . " " . $utc . " UTC</h3>"; echo "<h4>Note: Your timezone offset is " . $offset . " hours from UTC</h4>"; /** Connect to database **/ /*********************** * Get table record counts ***********************/ echo '<table><tbody><tr><th class="stattitle" colspan="2">Log Tables</th></tr>'; echo '<tr><th>Table</th><th>Row Count</th></tr>'; foreach($tables as $tblname) { $num = $numrows[0]; /* Table output */ echo '<tr>'; echo '<td>'.$tblprefix.$tblname.'</td>'; echo '<td align="right">'.$num."</td>"; echo '</tr>'; } echo '</tbody></table></body></html>'; /*********************** * End of report ***********************/ ?>
URL: http://www.magentocommerce.com/boards/viewthread/51142/P90/#t271250