Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Asterisk (IP-PBX) CDR Log Rotation

2,515 views

Published on

Notes of how to do Asterisk CDR log rotation

Published in: Technology
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Asterisk (IP-PBX) CDR Log Rotation

  1. 1. Asterisk(IP-PBX) CDR log rotation (with Linux Cron) William.L wiliwe@gmail.com 2014-03-17
  2. 2. Outline Asterisk CDR Crond Logrotate Put All Together Reference
  3. 3. CDR - Call Detail Records CDR contains information about calls that have passed through Asterisk system Asterisk assumes that you want to store CDR information CDR is store in CSV (Comma-Separated Value) format Asterisk CDR (1/4)
  4. 4. By default, Asterisk creates a CDR file named Master.csv in the folder /var/log/asterisk/cdr-csv and call information is stored in this file To the naked eye, Master.csv file’s content looks like a bit of a mess. If, however, you separate each line according to the commas, you will find that each line contains information about a particular call. Asterisk CDR (2/4)
  5. 5. A Comma-Separated Values (CSV) file is a common method of formatting database-type information in a text file You can open CSV files with a text editor, but most spreadsheet(likes Microsoft Excel) and database programs will also read them and properly parse them into rows and columns Asterisk CDR (3/4)
  6. 6. By default, Asterisk will simply add to the files until the storage (hard drive or other non-valotile storage) is full In Asterisk 1.4 Basic call (2-way) generates 245 ~ 247 bytes of CDR content Conference call (3-way) generates around 494 bytes of CDR content Asterisk CDR (4/4)
  7. 7. Linux provides utilities to handle the rotation of log files So that no single file becomes too large Also, the deletion of older logfiles (which will prevent the system from getting clogged with log files) logrotate is a tool to do “log rotation” : Regular (daily, weekly, monthly, etc) moving of an existing log file to some other file name and starting fresh with an empty log file After a period the old log files get thrown away Logrotate (1/2)
  8. 8. logrotate tool is often run on a cron job, which has the effect of fully automatic log rotation One of downloadable site for source : https://fedorahosted.org/logrotate/ Logrotate (2/2)
  9. 9. cron is a job scheduling facility in Linux/Unix system. The cron system is managed by cron daemone, crond It gets information about which program and when they should run At system startup cron daemon is invoked Cron (1/7)
  10. 10. cron daemone searches following target every minute /etc/cron.d folder /etc/crontab file(cron table) /var/spool/cron folder Under /etc/cron.d and /var/spool/cron folder there have shell script files named after accounts in /etc/passpwd file and are executed by cron daemone when it is time to do scheduled job Cron (2/7)
  11. 11. On system using Vixie cron, jobs that occure hourly, daily, weekly and monthly are kept in separate directories in /etc: /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly /etc/crontab stores these folders as table entries Cron (3/7)
  12. 12. Vixie cron uses the program run-parts to run shell scripts in each folder listed in /etc/crontab Cron (4/7)
  13. 13. On CentOS 6, Vixie cron uses the program run-parts to run shell scripts in each folder listed in /etc/anacrontab Cron (5/7)
  14. 14. cron command explanation Cron (6/7) http://linuxblog.pansapiens.com/wp-content/uploads/2008/06/cron.png
  15. 15. Note: In MS-Windows environment, there has a built-in tool functioning as Cron named Windows Task Scheduler http://en.wikipedia.org/wiki/Windows_Task_Scheduler Cron (7/7)
  16. 16. To do Asterisk CDR log rotation, it needs to configure cron job using lograte tool Create a folder named logrotate.d in /etc Create a logrotate configuration file named asterisk in /etc/logrotate.d and place following content in this file (here setting maximum size of CDR file to 70K bytes for example) Put All Together (1/3) /var/log/asterisk/cdr-csv/Master.csv { daily missingok size 70k rotate 2 copytruncate }
  17. 17. Create a shell script named logrotate in /etc/cron.daily and its content is as below (assume logrotate could be invoked from directory /usr/sbin): Put All Together (2/3) #!/bin/sh /usr/sbin/logrotate /etc/logrotate.d/asterisk EXITVALUE=$? if [ $EXITVALUE != 0 ]; then /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" fi exit 0
  18. 18. To see the status of execution of logrotate /var/lib/ logrotate.status How often does system do CDR log rotation? Depening on call traffic volume, e.g the speed of size increasing of Master.csv Put All Together (3/3)
  19. 19. Asterisk CDR log rotation http://www.voip-info.org/wiki/view/logrotate http://www.voip-info.org/wiki/view/logrotate+Chinese More information about the usage of logrotate configuration file http://www.thegeekstuff.com/2010/07/logrotate- examples/ http://linuxconfig.org/logrotate http://www- uxsup.csx.cam.ac.uk/~jw35/courses/apache/html/x167 0.htm Reference

×