It would be great if the statistics module allowed users to select the option NEVER (in the module settings) for when to discard old access logs. I'm doing long term data collection about my website usage and I don't want my usage data to be reset when it becomes older than 4 months...

Thanks in advance,

Leo

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

magico’s picture

Version: 4.6.5 » x.y.z
ChrisBryant’s picture

Version: x.y.z » 5.x-dev

+1 vote for this as well. Additionally, a setting for archiving the data at an interval would be ideal. That way the table size could be kept down but the data would still exist, maybe downloaded as csv.

Chris

PS: I'm not sure if this should be 5.x-dev or 6.x-dev (probably 6.x I assume but it's set for 5.x for now.)

geodaniel’s picture

Version: 5.x-dev » 6.x-dev

Sounds like a sensible suggestion. I'd also like to add a few more options of 26 and 52 weeks to extend it a little.

As for archiving, you could always do that directly from your database as and when required...

(moved to 6.x-dev as no new features will make it into 5.x now as far as I'm aware)

geodaniel’s picture

Assigned: Unassigned » geodaniel
Status: Active » Needs review
FileSize
2.5 KB

I've rolled a patch against current HEAD that:

  • stops logs being discarded if access logging is disabled
  • allows admin to enable/disable discarding of old access logs
  • adds options for 26 weeks (6 months) and 1 year to the flush period
Chris Johnson’s picture

+1 to the idea of allowing never and longer periods of data collection, e.g. Dan's 26 and 52 week periods.

Patch looks good on inspection (I have not tested it).

geodaniel’s picture

I've also been thinking of other ways to make it more flexible, so people aren't limited to set periods, and could enter their own. I'm not entirely sure I like it, but one way I thought of doing this would be to have two fields: a text field for an integer and a dropdown selection box with 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months' (? not fixed period) or 'years'.

peterx’s picture

Patch is working on my 5.0 sites and replaces nicely some code I added to 4.6. For those who want complete control over deletion, the deletion could be moved to a function that is called with the date for deletion. External modules could then request the deletion. The deletion could be added to an archive module that copies the log to an archive then requests the deletion. You would need a matching data request function so someone could request:

$date = 12345;
$old = statistics_old_data_get($date);
// Add old to archive. On success:
statistics_old_data_delete($date);
ChrisBryant’s picture

Sometimes there is also the need to completely reset, so that might be good to add an option for "Reset Logs" as well. I guess it could be done with the date changes that geodaniel suggested but say to delete at the current date/time.

bdragon’s picture

Status: Needs review » Needs work

Patch no longer applies due to the page split.

Dave Reid’s picture

Version: 6.x-dev » 7.x-dev
Assigned: geodaniel » Unassigned

Moving up to Drupal 7.

Dave Reid’s picture

Issue tags: +Novice

Adding the novice tag. Anyone want to pick this up?

davyvdb’s picture

Status: Needs work » Needs review
FileSize
2.11 KB
davyvdb’s picture

Why not do this for dblog too? http://drupal.org/node/560484

mgifford’s picture

+1

I like the idea of never discarding it. Patch applies cleanly.

janusman’s picture

Status: Needs review » Reviewed & tested by the community

Works.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense to me. Committed to HEAD!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ahjota’s picture

Version: 7.x-dev » 6.15
Status: Closed (fixed) » Active

Would like to see this in D6 as well. Doesn't seem too hard, but I don't have any experience with the patch system (yet).

Dave Reid’s picture

Version: 6.15 » 6.x-dev
Status: Active » Patch (to be ported)
bdragon’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.98 KB

Here's a quick backport.

jzacsh’s picture

Status: Needs review » Reviewed & tested by the community

seems to work. option is available. however, i'm not sure how legitimate of a review this is, seeing as I'd have to set my clock forward on my system, to see if the logs ever get discarded, and thus watch the patch in action/time.

works, though, from what I can tell.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

Automatically closed -- issue fixed for 2 weeks with no activity.