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

2012-12-05 Thread Earl Ruby

On 12/04/2012 08:48 PM, Paul Belanger wrote:

Not so, logroate actually supports strftime %s, so you get the number of
seconds since the Epoch.  Easily converted into any datetime format you
wish.


What's the logrotate dateformat string that generates MMDDHHMISS? 
According to the man page, it doesn't support that, but you say that 
it's easily converted into any datetime format you want, and that's 
the datetime format I want. Is the man page out of date?






--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


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

2012-12-04 Thread Earl Ruby

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 MMDD, not hours, minutes, 
or seconds, once again you're limited to daily roll-overs. 
(asterisk-cdr-rollover generates file names using the format 
cdr-MMDDHHMISS.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

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


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

2012-12-04 Thread Earl Ruby

That's what you actually use? In production?


On 12/04/2012 12:51 PM, Tzafrir Cohen wrote:

On Tue, Dec 04, 2012 at 10:05:47AM -0800, Earl Ruby wrote:

Paul:

Four reasons not to use logrotate:

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


   apt-get install logtail

logtail2 - print log file lines that have not been read

Every 15 minutes use it to get the new lines from the CSV file. Rotate
it when needed with logrotate.



--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


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

2012-12-03 Thread Earl Ruby
If you are trying to provide CDR files to a billing service, such as 
WebCDR.com, you need to provide files containing your latest call data 
every 15 minutes or so. I wrote a script and a cron job that will create 
a new CDR file every 15 minutes with the latest CDR records, without 
interrupting call flow. You do not need to make any changes to your 
Asterisk configuration to use these scripts.


There are two files that you need to install on your Asterisk server:

asterisk-cdr-rollover.sh – A bash shell script. Copy this file into 
/usr/local/sbin. This script moves the file 
/var/log/asterisk/cdr-csv/Master.csv to a new file named 
/var/log/asterisk/cdr-csv/cdr-MMDDHHMISS.csv, where MMDDHHMISS 
is the current time. A new zero-byte Master.csv file is created using 
the default umask of the user running the asterisk process. Asterisk 
will start writing to the new Master.csv file at the end of the next call.


asterisk-cdr-rollover – This is a cron job. Copy it into /etc/cron.d and 
it will run the /usr/local/sbin/asterisk-cdr-rollover.sh script once 
every 15 minutes.


The cron job is set up to run as the user “asterisk”. If you are running 
asterisk as “root” or some other user name, edit the 
asterisk-cdr-rollover cron job and change the name of the user running 
the script to the same name as the user running the asterisk process.


The latest versions of these two files can be downloaded from GitHub: 
https://github.com/earlruby/asterisk-cdr-rollover.



--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users