[asterisk-dev] cdr-custom rotate?
John Todd
jtodd at digium.com
Wed Aug 13 12:29:38 CDT 2008
At 9:54 AM +0000 2008/8/9, Tony Mountifield wrote:
>
>In article <006501c8f9ec$b50968f0$1f1c3ad0$@com>,
>Venefax <venefax at gmail.com> wrote:
>> I have to rotate the Master.csv every 5 minutes, on a heavy loaded system. I
>> use cdr-custom. How do I force asterisk to rename the cdr file every 5 mins?
>> Is there a way?
>
>It doesn't look as if Asterisk holds the file open, but rather opens it every
>time it wants to add a record. So you can just have a cron script that renames
>the file whenever you want, and Asterisk should recreate Master.csv the next
>time it wants to write a CDR.
>
>Try a crontab entry like this:
>
>*/5 * * * * cd /var/log/asterisk/cdr-custom; mv Master.csv
>Master`date +'\%FT\%H:\%M'`.csv ; touch Master.csv
>
>Cheers
>Tony
Feature idea:
We have the concept of log rotation in logger.conf. Why don't we use
the same routines and configuration file syntax for rotating CDR CSV
logs? Then we could embed the rotation of CSV CDR files into
Asterisk instead of using cron jobs (though cron systems would be
unaffected unless "persistent=yes" was set with our theoretically new
command below.) "cdr csv rotate" might be the appropriate command.
This would remove yet another external requirement for
platform-specific scripts to operate and manage Asterisk in a
production environment.
In a somewhat unrelated question:
Are the resources consumed by opening/closing the cdr files
excessive in high-volume circumstances?
The reason I ask is that in some environments ("redirectors" for
large arrays of other machines, or even just volume test platforms)
the amount of call leg creation/destruction is fairly high -
sometimes hundreds per second. If it is in fact the case that
Asterisk opens/closes the CDR files every time a new record is
written, it seems like this would be a fairly high penalty.
Would it be possible or prudent to create a "persistent=[yes,no]"
option for CSV configuration? Or does the "batch=yes" setting
provide an adequate alternative in by keeping the file closed until a
certain number of calls or time interval has reached a maximum value?
JT
--
--
John Todd
jtodd at digium.com +1-256-428-6083
Asterisk Open Source Community Director
More information about the asterisk-dev
mailing list