Earl Ruby
2012-Dec-04 05:59 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
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-YYYYMMDDHHMISS.csv, where YYYYMMDDHHMISS 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.
Paul Belanger
2012-Dec-04 15:01 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
On 12-12-04 12:59 AM, Earl Ruby wrote:> 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-YYYYMMDDHHMISS.csv, where YYYYMMDDHHMISS > 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. > >Why not use logroate? $ man logrotate -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger
Danny Nicholas
2012-Dec-04 15:02 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
IIRC log rotate only rolls the files in /var/log/asterisk, not /var/log/asterisk/cdr-csv -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Paul Belanger Sent: Tuesday, December 04, 2012 9:01 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes On 12-12-04 12:59 AM, Earl Ruby wrote:> 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-YYYYMMDDHHMISS.csv, where YYYYMMDDHHMISS > 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. > >Why not use logroate? $ man logrotate -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger -- _____________________________________________________________________ -- 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
Paul Belanger
2012-Dec-04 15:11 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
On 12-12-04 10:02 AM, Danny Nicholas wrote:> IIRC log rotate only rolls the files in /var/log/asterisk, not > /var/log/asterisk/cdr-csv >You need to configure logroate with the path and filename. -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger
Danny Nicholas
2012-Dec-04 15:17 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
Elaborate please. When does this feature come into effect? -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Paul Belanger Sent: Tuesday, December 04, 2012 9:12 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes On 12-12-04 10:02 AM, Danny Nicholas wrote:> IIRC log rotate only rolls the files in /var/log/asterisk, not > /var/log/asterisk/cdr-csv >You need to configure logroate with the path and filename. -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger -- _____________________________________________________________________ -- 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
Logan Bibby
2012-Dec-04 15:18 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
I have a huge logrotate config file and I use Webmin to manage it all. Actually, Webmin is a good all-around system management tool, in my opinion. On Dec 4, 2012 9:12 AM, "Paul Belanger" <paul.belanger at polybeacon.com> wrote:> On 12-12-04 10:02 AM, Danny Nicholas wrote: > >> IIRC log rotate only rolls the files in /var/log/asterisk, not >> /var/log/asterisk/cdr-csv >> >> You need to configure logroate with the path and filename. > > -- > Paul Belanger | PolyBeacon, Inc. > Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) > Github: https://github.com/pabelanger | Twitter: > https://twitter.com/pabelanger > > -- > ______________________________**______________________________**_________ > -- 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<http://lists.digium.com/mailman/listinfo/asterisk-users> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20121204/7d0e8034/attachment.htm>
Tzafrir Cohen
2012-Dec-04 15:55 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
On Tue, Dec 04, 2012 at 09:17:39AM -0600, Danny Nicholas wrote:> Elaborate please. When does this feature come into effect?man logrotate.conf #? Just list the files you want to rotate in /etc/logrotate.d/asterisk (or whereever). -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
Danny Nicholas
2012-Dec-04 16:01 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
I was confusing the linux function logrotate with the asterisk function "logger rotate". -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tzafrir Cohen Sent: Tuesday, December 04, 2012 9:56 AM To: asterisk-users at lists.digium.com Subject: Re: [asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes On Tue, Dec 04, 2012 at 09:17:39AM -0600, Danny Nicholas wrote:> Elaborate please. When does this feature come into effect?man logrotate.conf #? Just list the files you want to rotate in /etc/logrotate.d/asterisk (or whereever). -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir -- _____________________________________________________________________ -- 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
A J Stiles
2012-Dec-04 16:43 UTC
[asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
On Tuesday 04 December 2012, Logan Bibby wrote:> I have a huge logrotate config file and I use Webmin to manage it all. > > Actually, Webmin is a good all-around system management tool, in my > opinion.Just not on a box with an outside-world IP address, though ..... -- AJS Answers come *after* questions.