Page 1 of 1

ADMIN_archive_log_tables.pl question

PostPosted: Fri Mar 10, 2017 1:28 pm
by airflux
Hi guys,
I've a question for someone more skilled than me :)

I'm looking for a way to archive old call logs without deleting them, I've found ADMIN_archive_log_tables.pl script and the related cron that does a lot of things, but I'm not sure that _archive tables works like I think, there something strange too in the script (for me). I suppose that when live tables becomes too big, records need to be moved to _archive tables and stored to read them in reports for a long time. Checking the code I've noticed that _archive tables are trimmed too. Why? They are used just to run reports on differents tables?

I'm talking abount the 4th query in the following sequence trims the call_log_archive table (ADMIN_archive_log_tables.pl file)
1) INSERT IGNORE INTO call_log_archive SELECT * from call_log;
2) DELETE FROM call_log WHERE start_time < '$del_time'
3) optimize table call_log
4) DELETE from call_log_archive where channel LIKE 'Local/9%' and extension not IN('8365','8366','8367','8368','8369','8370','8371','8372','8373','8374') and caller_code LIKE 'V%' and length_in_sec < 75 and start_time < '$del_time'
5) optimize table call_log_archive

then if I run /usr/share/astguiclient/ADMIN_archive_log_tables.pl -months=6 this will delete records older that 6 months from call_log and that is fine, but what appens in call_log_archive? It will contains less records than call_log due due to where conditions?

I can just remove the second delete and reach my goal, but I want to learn more, more, more, then I hope someone will help me :)

Thanks

Re: ADMIN_archive_log_tables.pl question

PostPosted: Fri Mar 10, 2017 3:03 pm
by mflorell
Something to keep in mind with the log tables in VICIdial, is that the "call_log" table is not the most accurate table to use for logging the calls, in fact, almost none of the reports in VICIdial even use the call_log data. It is mostly used for keeping track of calls as they are being dialed, and optional manual dialing logging. Also, some auto-dial calls are actually double-logged, which is why that specific delete query is there.

Re: ADMIN_archive_log_tables.pl question

PostPosted: Sat Dec 14, 2019 1:11 pm
by VFRDavid
Mr. Florell...you stated that the call_log tables are used in almost none of the (stock) reports...is this still the case? My call_log_archive is over 40Gb, and I would like to recover that storage space, but do not want to lose any data that doesn't exist elsewhere, without knowing what I am giving up. I could search the source to see where the tables are used, but, if you know the answer off the top of your head (and if anyone would...it'd probably be you), I would get to be lazy...

8)

Thanks for any info you can provide...

David

Re: ADMIN_archive_log_tables.pl question

PostPosted: Sat Dec 14, 2019 3:32 pm
by mflorell
Yes, that is still the case, feel free to wipe out(or TRUNCATE) your call_log_archive table, because that data is used in almost none of the reports.