Logging and tracing calls through it

So recently I’ve been working with asterisk log files a bit more and have come to notice one thing. There does not seem to be a way to trace individual calls through the processes the call goes through.

I’ve worked with a few different voip switches and all of them seem to have an event log that each row in the even log will contain a unique id for the call flowing through the components. Each component as it writes anything to the event log will write this unique id to the logfile so you can trace an individual call through the components and find out what went wrong when something goes wrong.

I may very well be overlooking the documentation on how to do this.

If anyone could point me in the right direction of any documentation for this or just tell me “there’s no way to do that” so I can cry a little.

Thanks

Cry is for girls, justind. “man asterisk” instead :laughing:

Seriously, Asterisk documentation leaves a lot to be wanted. If it doesn’t provide a “native” event log, the most straight-forward way to record all events during a call is to dump all console output to a file, e.g.,

Using tee, you can combine this with safe_asterisk. If you are familiar with *nix utilities/facilities, you can come up with more refined methods.

This will not provide all advantages of a true event log, but with free analysis tools like Splunk (no relations), it should serve most purposes well.

In the log each call has a event ID

tail +2000 /var/log/asterisk/full | grep -F ‘23538’ >23538.txt

the line above will give you a txt file 23538.txt with only the 23538 event data.

Is this what you are asking???

I think the closest solution is to do what valley suggested, although I’ll have to try it because I’m still not sure if it would be close enough for what I’m looking for.

bubba, I believe the ID’s you are looking at are either process ids or thread ids. There is no way that I can tell how to correlate actions that are being logged by pbx.c to chan_sip.c to app_voicemail.c. Either way, I know the same number isn’t logged to all the events pertaining to a given call.

I guess to simplify it all I would need an example.

Example:

You’re watching your event logs and you see a WARNING or ERROR message. Maybe something as simple as “WARNING[21398] file.c: Failed to write frame”. So you want to trace down what the caller was doing when this warning was logged, to see if it was an expected warning or if you’ve configured something incorrectly. The problem is there were 25 other calls up on the system, some checking their voicemail and others going through IVR menus. How can you pick out the events specific to what caused this warning message?

Perhaps I could submit this as some sort of feature request to the development group? It seems odd though that it doesn’t already exist. It would seem a much more useful tool for developers.

To follow a Sip call you will want to follow the Call ID in “sip debug”. For IAX2 you will want to follow the SCall and DCall in “iax2 debug”. For PRI you will want to follow the reference number in “pri debug span x”. For analog… there isn’t a way.

OK I think the event ID is per call as I can see a call from start to end this way.

and if you use the cmd and add to it you can sort the logs any way you wish
you can match errors with extens whatever…

This would be a very good feature request, especially considering competition.