[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes

Earl Ruby earl at switchmanagement.com
Tue Dec 4 12:05:47 CST 2012


Paul:

Four reasons not to use logrotate:

1. logrotate does not provide log rotation every 15 minutes.

2. logrotate will not create unique file names unless you use a date 
format in the name (file names with a .nnn extension get reused over 
time), but since logrotate only supports YYYYMMDD, not hours, minutes, 
or seconds, once again you're limited to daily roll-overs. 
(asterisk-cdr-rollover generates file names using the format 
cdr-YYYYMMDDHHMISS.csv.)

3. My customers need to be able to feed CDR files into a telecom 
billing, monitoring, fraud-detecting system I work on called WebCDR.com, 
which works best if it gets a new CDR file every fifteen minutes.

4. If there are no calls after 15 minutes, with asterisk-cdr-rollover I 
get a zero byte file, which can trigger a "no calls" alarm, alerting me 
that something is wrong with the Asterisk switch. (The switch setup I'm 
working will always have some calls within a 15 minute block if 
everything is working correctly, although people with less-busy switches 
can always configure a larger alarm window to suit their situations.) If 
you're running a high-traffic switch, this can be a life-saver.

If you want a copy, go to 
https://github.com/earlruby/asterisk-cdr-rollover and click the ZIP 
button to download the script and cron job. It's free.

-- Earl


On 12/04/2012 07:01 AM, Paul Belanger wrote:
> Why not use logroate?
>
> $ man logrotate
>

-- 
Earl C. Ruby III
Director of Engineering



More information about the asterisk-users mailing list