Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log rotate: Add option to limit the number of rotated log tables (Trac #3253) #3253

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 9 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/3253 on 41236160-08-24 by cash, assigned to trac user fierdor.

Elgg version: 1.7

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*

@elgg-gitbot
Copy link
Author

trac user fierdor wrote on 41252702-04-19

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?

@elgg-gitbot
Copy link
Author

cash wrote on 41252724-10-29

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.

@elgg-gitbot
Copy link
Author

trac user ashwanth wrote on 41259551-05-28

fierdor are you working on this Bug fix?

@elgg-gitbot
Copy link
Author

cash wrote on 41259643-05-02

Replying to ashwanth:

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

@elgg-gitbot
Copy link
Author

trac user ashwanth wrote on 41259650-12-20

Replying to cash:

Replying to ashwanth:

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

@elgg-gitbot
Copy link
Author

trac user fierdor wrote on 41261197-11-20

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.

@elgg-gitbot
Copy link
Author

brettp wrote on 41299619-09-21

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

@elgg-gitbot
Copy link
Author

Milestone changed to Elgg 1.8 by brettp on 41299619-09-21

@elgg-gitbot
Copy link
Author

brettp wrote on 41321982-04-22

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant