Greetings. I'm wondering if anyone has any insight into this dillema.

I have my "Discard access logs older than:" set to 16 weeks, but they are discarding after 4 days. Below are my settings from the 'variable' table in my database that pertain to site statistics, as well as the source code from the "/admin/settings/statistics" page where the variable is set. Both the database record and the HTML source both show 9676800 for the "statistics_flush_accesslog_timer" value, I'm unsure what type of measurement this is, and if it's correct, maybe someone out there knows?

Much appreciated.

"Variable" dupal database table setting pertaining to site statistics:

statistics_day_timestamp  	i:1150860773;
statistics_enable_access_log 	s:1:"1";
statistics_flush_accesslog_timer 	s:7:"9676800";
statistics_count_content_views 	s:1:"1";
statistics_display_counter 	s:1:"0";
statistics_block_top_day_num 	s:1:"5";
statistics_block_top_all_num 	s:1:"0";
statistics_block_top_last_num 	s:1:"0";

HTML source from "/admin/settings/statistics" showing "Discard access logs older than:" choices:

<div class="form-item">
	<label for="edit-statistics_flush_accesslog_timer">Discard access logs older than:</label> <select name="edit[statistics_flush_accesslog_timer]" class="form-select" id="edit-statistics_flush_accesslog_timer">
		<option value="3600">
			1 hour
		</option>
		<option value="10800">
			3 hours
		</option>
		<option value="21600">
			6 hours
		</option>
		<option value="32400">
			9 hours
		</option>
		<option value="43200">
			12 hours
		</option>
		<option value="86400">
			1 day
		</option>
		<option value="172800">
			2 days
		</option>
		<option value="259200">
			3 days
		</option>
		<option value="604800">
			1 week
		</option>
		<option value="1209600">
			2 weeks
		</option>
		<option value="2419200">
			4 weeks
		</option>
		<option value="4838400">
			8 weeks
		</option>
		<option value="9676800" selected="selected">
			16 weeks
		</option>
	</select> 
	<div class="description">
		Older access log entries (including referrer statistics) will be automatically discarded. Requires crontab.
	</div>
</div>

Comments

pwolanin’s picture

The numerical value is # of seconds (i.e. 1 hour = 60 * 60 = 3600).

---
Work: BioRAFT

conkdg’s picture

I've been digging around and it seems as though the function variable_get(), that is being called from statistics.module is always defaulting to 259200 (3 days) at line 367 instead of retreiving 9676800 (16 weeks) from the database variable as it should be doing.

The function below is called several times in statistics.module, and appear to be working correctly for most of the calls, but is malfunctioning at line 367 where the cron hook is impimented to flush old data out of the logs

/**
 * Implementation of hook_cron().
 */
function statistics_cron() {
  $statistics_timestamp = variable_get('statistics_day_timestamp', '');

  if ((time() - $statistics_timestamp) >= 86400) {
    /* reset day counts */
    db_query('UPDATE {node_counter} SET daycount = 0');
    variable_set('statistics_day_timestamp', time());
  }

  /* clean expired access logs */
  db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
}
pwolanin’s picture

I haven't looked at this much, but in your dump of the variables at the top, statistics_day_timestamp seems to be stored as an integer, while statistics_flush_accesslog_timer is stored as a sting. Could that be the problem? Maybe a bug when saving/validating the form data where the value is set?

Probably worth posting an issue on this- it seems like a real bug one way or the other.

---
Work: BioRAFT

thomas.lie’s picture

Hi Steve (conkdg),

did you manage to get this to work?
I also had my logs set for 16 weeks, but i don't have all data

is there anyway, I can retrieve those data, especially mail-types?

thanks,
thomas