How to recreate the queue_log file from database data
The following MySQL query can be used to generate a queue_log file based on the data stored in Asternic MySQL tables, this is useful if you want to upgrade to a new version, or move Asternic to another server when you cannot dump the complete database, or passing the data from lite to pro versions. The query to run in Asternic Lite and Asternic PRO versions older than 2.0.0:
SELECT unix_timestamp(datetime),uniqueid,queue,agent,event,info1,info2,info3,info4 FROM queue_stats q
INNER JOIN qname ON qname = qname.qname_id INNER JOIN qagent ON q.qagent = agent_id
INNER JOIN qevent ON q.qevent = qevent.event_id ORDER BY datetime,queue_stats_id INTO OUTFILE '/tmp/queue_log_generado' FIELDS TERMINATED BY '|';
For Asternic 2.0.0 or higher the query is:
SELECT unix_timestamp(datetime),uniqueid,queue,agent,event,info1,info2,info3,info4,info5 FROM queue_stats q
INNER JOIN qname ON qname = qname.queue_id INNER JOIN qagent ON q.qagent = agent_id
INNER JOIN qevent ON q.qevent = qevent.event_id ORDER BY datetime,queue_stats_id INTO OUTFILE '/tmp/queue_log_generado' FIELDS TERMINATED BY '|';
After running the above query, you will have a new file inside /tmp
with a pristine queue_log file that can be used to parse using the asterniclog service.