[asterisk-dev] Some wild thoughts about logging

Johan Wilfer johan at wilfer.se
Tue Sep 9 13:45:13 CDT 2008


Atis Lezdins skrev:
> On Tue, Sep 9, 2008 at 4:22 PM, Russell Bryant <russell at digium.com> wrote:
>   
>> Johan Wilfer wrote:
>>     
>>> What if we could tie (almost) every event that got logged to the specific
>>> call id? Sip history dump, notice's, whatever. Then you could dump it
>>> into a database, and when
>>> the customer calls again you could easily find the relevant information
>>> from the log. As of now I spend some
>>> amount of time in my /var/asterisk/logs/ comparing call numbers and try
>>> to understand what my customer did.
>>>
>>> Also - you could easily delete info that is too old to be saved and so on.
>>>
>>> What do you think? Let's do some brainstorming..
>>> Is this possible and how can it be implemented?
>>>       
>> This would absolutely be useful, and has been discussed a number of
>> times.  The first step is a _huge_ one, and that is to add an argument
>> to all of the calls to ast_log and ast_verbose to include the relevant
>> ast_channel if there is one.  Then, logging mechanisms could take
>> advantage of having access to channel data.
>>
>> I guess we could make the API changes in trunk, and then have the mass
>> conversion be a janitor project ...
>>
>>     
>
> I think trunk has linked_id, so logs can be filtered by that. I
> currently have dialplan-implemented linked_id which is basically first
> uniqueid for call. Then a simple script helps me retrieve necessary
> log:
>
> #!/bin/bash
>
> if [ "$1" == "" ]; then
>   echo "Usage: fetch.sh <call_id>"
>   exit 1;
> fi
>
> if [ "$2" == "" ]; then
> LOG_FILE="cat /var/log/asterisk/full"
> else
> LOG_FILE="cat /var/log/asterisk/full.$2.gz | gunzip"
> fi
>
> A="$LOG_FILE | grep -F $1 > /tmp/callid.txt"
> eval $A
> cat /tmp/callid.txt | grep -o -P
> "(?:ERROR|WARNING|VERBOSE|DEBUG)\[([0-9]*)\]" | grep -o "\[[0-9]*\]" |
> uniq | s
> A="$LOG_FILE | grep -F -f /tmp/callid_pids.txt > callid_$1.log"
> eval $A
>
> rm /tmp/callid.txt
> rm /tmp/callid_pids.txt
>   
Wow. Would this work with 1.4 as well?
/Johan



More information about the asterisk-dev mailing list