Re: [asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
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
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-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. Why not use logroate? $ man logrotate -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belan...@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
Re: [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-boun...@lists.digium.com [mailto:asterisk-users-boun...@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-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. Why not use logroate? $ man logrotate -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belan...@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 -- _ -- 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
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.belan...@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
Re: [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-boun...@lists.digium.com [mailto:asterisk-users-boun...@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.belan...@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 -- _ -- 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
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.belan...@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.belan...@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-**usershttp://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- 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
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.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@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
Re: [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-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tzafrir Cohen Sent: Tuesday, December 04, 2012 9:56 AM To: asterisk-users@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.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@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 -- _ -- 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
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. -- _ -- 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
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
It is facing the outside world, but I just use SSH's port forwarding. :) On Dec 4, 2012 10:43 AM, A J Stiles asterisk_l...@earthshod.co.uk wrote: 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. -- _ -- 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 -- _ -- 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
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. -- Tzafrir Cohen icq#16849755 jabber:tzafrir.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@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
Re: [asterisk-users] How to roll-over / move / rotate an Asterisk Master.csv call detail record (CDR) file every 15 minutes
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
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 01:05 PM, Earl Ruby wrote: Paul: Four reasons not to use logrotate: 1. logrotate does not provide log rotation every 15 minutes. Sure it does, you can invoke it using crontab, like you do for your script. 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.) 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. 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. postrotate/endscript should work for this. 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. No native support, but you could invoke logic using postrotate/endscript from above. 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. Understood. If it works for you that is great, I was mostly trying to understand why you choose to rewrite logrotate :) -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belan...@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