LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2009, 08:26 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
Logrotate not as expected


I have the following logrotate-code :

Code:
/var/log/asterisk/* /var/log/asterisk/cdr-csv/* {
   weekly
   rotate 5
   compress
   maxage 60
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}
But below you see it is not working as expected :

Code:
debug
debug.1.gz
debug.1.gz.1.gz
debug.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.1.gz.3.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.2.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.3.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.3.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.1.gz.4.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.2.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.2.gz.3.gz
debug.1.gz.1.gz.1.gz.1.gz.3.gz
debug.1.gz.1.gz.1.gz.1.gz.3.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.3.gz.1.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.3.gz.2.gz
debug.1.gz.1.gz.1.gz.1.gz.4.gz
debug.1.gz.1.gz.1.gz.1.gz.4.gz.1.gz
debug.1.gz.1.gz.1.gz.1.gz.5.gz
debug.1.gz.1.gz.1.gz.2.gz
debug.1.gz.1.gz.1.gz.2.gz.1.gz
debug.1.gz.1.gz.1.gz.2.gz.1.gz.1.gz
What I want is
debug.1
debug.2
debug.3
debug.4
debug.5

and after 5 it returns to 1 and so forth...

That way I always have 4 weeks of logfiles...

Code:
debug
debug.1.gz
debug.2.gz
debug.3.gz
debug.4.gz
debug.5.gz

Last edited by jonaskellens; 10-17-2009 at 08:33 AM.
 
Old 10-17-2009, 08:33 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Greetings!
You need to drop the asterisks ("*") and specify the exact file you want to rotate. It's rotating the already rotated logs.

Also, you need to only specify one file at a time.

Example:
Code:
/var/log/asterisk/debug {
   weekly
   rotate 5
   compress
   maxage 60
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}

/var/log/asterisk/cdr-csv/debug {
   weekly
   rotate 5
   compress
   maxage 60
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate invent Linux - Enterprise 1 08-19-2008 09:45 AM
logrotate Ronin_tekorei Linux - Newbie 2 02-07-2008 06:44 AM
Why we use logrotate ? shipon_97 Linux - Newbie 4 01-09-2008 10:15 AM
Logrotate Help! MaverickApollo Linux - Software 3 02-19-2004 01:09 PM
logrotate dominant Linux - Newbie 1 02-13-2004 10:28 AM


All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration