We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 2 years ago

#3253 closed Enhancement (fixed)

Add option to limit the number of rotated log tables

Reported by: cash Owned by: fierdor
Priority: normal Milestone: Elgg 1.8.0
Component: Log Rotate Version: 1.7
Severity: minor Keywords:
Cc: brett@… Difficulty: moderate

Description

The current log rotation plugin takes the current system log table and copies it into an archive table. Site administrators then have to manually export/drop the tables. It would be better to work more like unix log rotation where an administrator can specify how many old logs to keep.

This requires adding a plugin setting (probably a drop down to select the number of old log tables to keep). We would also have to write a little SQL to get the table names that match <db_prefix>_system_log_*


Change History (9)

comment:1 Changed 2 years ago by fierdor

Will it be okay if I create another table "prefix"system_log_numbers where I will store an id and with it the value of $now()

For eg.

Id time_created
1 1300723597
2 1300723345
3 1300712597

Then when I need to delete I can just run a query to obtain "prefix"system_log_* to obtain the archived tables if they exceed the number of tables in the settings.
Like:
if count_of_rows(system_log_numbers) > number_of_archived_tables
delete system_log_* where *=time_created from system_log_numbers where id>number_of_archived_tables.

Is this design okay?

comment:2 Changed 2 years ago by cash

You shouldn't need to create a table for this (and we prefer to not add any additional tables). Check out http://dev.mysql.com/doc/refman/5.5/en/show-tables.html

Something like "show tables like [elgg db prefix]system_log%" should work. Then parse the returned table names to get the dates.

comment:3 Changed 2 years ago by brettp

  • Owner set to fierdor

comment:4 follow-ups: Changed 2 years ago by ashwanth

@fierdor are you working on this Bug fix?

comment:5 in reply to: ↑ 4 ; follow-up: Changed 2 years ago by cash

Replying to ashwanth:

Yes, he's been on the #elgg IRC channel talking about it

comment:6 in reply to: ↑ 5 Changed 2 years ago by ashwanth

Replying to cash:

Replying to ashwanth:

Yes, he's been on the #elgg IRC channel talking about it

Fine!

comment:7 in reply to: ↑ 4 Changed 2 years ago by fierdor

Replying to ashwanth:

@fierdor are you working on this Bug fix?

Hey I am. I have put in a pull request. Waiting for review. Need to modify according to elgg coding standards.

comment:8 Changed 2 years ago by brettp

  • Milestone changed from Elgg 1.8.x to Elgg 1.8

Let's get this pull request in before we get out of sync.

comment:9 Changed 2 years ago by brettp

  • Resolution set to fixed
  • Status changed from new to closed

(In [svn:9033]) Fixes #3253. Merged in Shashank's patch.

Note: See TracTickets for help on using tickets.