Seperate log file per call

Hi,

Our implementation is quite simple, we have an autodialler which is triggered by dropping a call file into /var/spool/asterisk/outgoing

My question is - I know by running “logger rotate” this creates a new log file, i.e. Full.0, Full.1 etc. Is it possible to run that from the start of the dialplan to generate a new log per call and is it possible to specify a different filename then Full.* ?

Thanks

The logging isn’t just for calls, it is for all activity on the system. If you want a log file per call, you made have to look at something like HEP/SIPCapture to do this.

If you ONLY ever have 1 active call at a time, you COULD do it in the dialplan, by running an external script. This will give you a new logfile, that has everything that happened during that call. If you have multiple calls, the logs will be cut off whenever a new call starts.

But the real question here is, what exactly do you want to archive? There might be a better way to do it.

I have done my own per-call event logging, but that involves keeping careful track of the events associated with the original number being dialled, via Uniqueid fields and the like.

A little hacky but might be useful - greps out log file into one new file per call - breaks when you restart Asterisk (because the call counter resets).

First do this:

cut -f3 -d] /var/log/asterisk/full | grep '\[C-' | cut -f2 -d[ | sort | uniq | xargs -I@ echo "grep @ /var/log/asterisk/full > /tmp/half-full.@"

And if you like what you see, add a pipe to shell at the end in order to generate files into /tmp directory:

cut -f3 -d] /var/log/asterisk/full | grep '\[C-' | cut -f2 -d[ | sort | uniq | xargs -I@ echo "grep @ /var/log/asterisk/full > /tmp/half-full.@" | sh

Yes, if you change rotate strategy or file name (configuration is in /etc/asterisk/logger.conf) then issue “logger reload” or similar, all before the call.