AstRecipes » Rebuilding Fonality queue_logOn a number of Fonality boxes, you'll find that the queue_log file, which content is critical to the correct running of QueueMetrics, is deleted almost immediately and moved to varius files under the /var/log/asterisk/real filesystem.
In order to make this work with QueueMetrics, we prepared a small script that will rebuild the queue_log out of the snippets in real. In order not to overload the system, we take only s pecified period pof time (eg 30 days) into consideration for the rebuilding. Here is the script called rebuildqlog.sh
Then we need to call this script every 15 seconds or so in order to have a reasonably up-to-date version of the queue_log file ready for use by QueueMetrics. So we create the file run_rebuild.sh:
# uso: ./rebuildqlog.sh /var/log/qm_qlog
rm -f $LOGT $LOGS
nice find /var/log/asterisk/real -name queue_log.* -mtime -$MAXDAYS | xargs cat >> $LOGT
cat /var/log/asterisk/queue_log >> $LOGT
nice sort --buffer-size=10M $LOGT | uniq > $LOGS
rm -f $LOGT $LOGF
mv $LOGS $LOGF
And we run everything by typing:
while [ true ]
nice /root/rebuildqlog.sh /var/log/qm_qlog
As we build the "new" queue_log in a different location, we'll have to modify the file configiration.properties in QueueMetrics in order to tell it where the queue_log to use actually is:
nohup /root/run_rebuild.sh &
This should do the trick. Note:
# This is the default queue log file.
You cannot use the new queue_log file with qloaderd, as the file is constantly rebuilt.