How to reparse old or unprocessed queue_log files?

Howto


By default, the asterniclog log parser will skip processing for log entries that are older than the last event available in the database. This is done for performance reasons, as you do not want the computer wasting CPU time trying to insert data that was already inserted before.

But sometimes a table gets corrupted and some entries are not parserd/incorporated, and you want to process old log files to incorporate that information into the database.

Supose you have these log files and want them processed:

/var/log/asterisk/queue_log.1
/var/log/asterisk/queue_log.2

First of all, you must stop the asterniclog service with the command:

service asterniclog stop

Once the service is stopped, you can reparse them by running asterniclog with the -r command line option. You should parse from the oldest log file, something like this:

cd /usr/local/parselog
./asterniclog -u qstatsUser -p qstatsPassw0rd -d qstats -r -l /var/log/asterisk/queue_log.2
./asterniclog -u qstatsUser -p qstatsPassw0rd -d qstats -r -l /var/log/asterisk/queue_log.1

Be sure to set the correct MySQL user name, password and database for your setup. The above example uses default credentials for Asternic 2.1.0 and up.

Finally, start the asterniclog service again:

service asterniclog start

You can now check the reports and see if that old data is now available.