[asterisk-users] Queue_logs

Matthew J. Roth mroth at imminc.com
Sun Sep 13 11:04:45 CDT 2009


Maria Cristina Bayno wrote:
> I'm here again and need your help. Regarding Queue logs in asterisk, 
> do anyone knows how can I get all the logs for the specific/particular 
> date? Example is I want to get all the logs from September 9-12?
>
>

Maria,

Here's a Bash script that will do what you're looking for.  If you 
redirect the output to a file it will only contain the queue_log records 
in the date range from start_epoch to end_epoch.  Note that it may take 
a while to complete, depending on the size of your queue_log.

--- Start getdates_ql 
----------------------------------------------------------
#!/bin/bash

start_epoch=`date -d 'Sep 9 2009 00:00:00' +'%s'`
end_epoch=`date -d 'Sep 12 2009 23:59:59' +'%s'`

while read line; do
    epoch=`echo $line | cut -d '|' -f 1`

    if [ $epoch -ge $start_epoch -a $epoch -le $end_epoch ]; then
      echo $line
    fi
done < /var/log/asterisk/queue_log

exit 0

--- End getdates_ql 
------------------------------------------------------------

Regards,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer




More information about the asterisk-users mailing list