0

I went though few resources in this forum like: How to rotate log based on an interval unless log exceeds a certain size? but, I don't see my log files being rotated daily. their max size for past couple of weeks are less than 10MB, but the Maxsize 10MB + daily should compress the file daily right?

/apps/alfresco-4.2.4/tomcat/logs/catalina.out {
    missingok
    maxsize 10MB + daily
    create 0755 mwtcs mwtcs
    rotate 1
  notifempty
  dateext
  compress
}

What is wrong with my code? What am I missing here? I'm new to this task.

Thanks in advance.

1
  • I don't have enough credits/reputation to add tags like maxsize, daily rotate etc :(
    – raja777m
    Jun 26, 2015 at 15:21

1 Answer 1

0

Change rotate 1 to how many times you want to rotate your log file before it will be deleted. Right now it will rotate only once. Only one file is hold.

their max size for past couple of weeks are less than 10MB, but the Maxsize 10MB + daily should compress the file daily right?

When the max size is reached (10M) file is truncated and - in your case - file will be always lower than 10M.

Check this https://www.youtube.com/watch?v=UoHmj3ef3Is if you want to learn logrotate.

Small Update: So, using rotate 10 and maxsize 10M is good if you have static amount of space for logs. Lets say 1GB of space = rotate 100 and maxsize 10M.

maxsize size

Log files are rotated when they grow bigger than size bytes even before the additionally specified time interval (daily, weekly, monthly, or yearly) ...

Your another question asked in comments should be asked in another topic, but here it goes: https://stackoverflow.com/a/27566659/4948699

maxage count

Remove rotated logs older than days. The age is only checked if the logfile is to be rotated.

3
  • After watching the video, which has rotate 99, means, 99 copies. Since, mine is rotate 1, I'm keeping only one copy. My requirements are to save records of past six months. So, my code change should be "rotate 180". correct me if i'm wrong.
    – raja777m
    Jun 26, 2015 at 17:43
  • No, you should use maxage count check man page. Right now, you would store 10M (or more M) files 180 times. Who knows if 10M is enought for one day log? ... I'll update answer in about ~40min, right now afk.
    – Abc Xyz
    Jun 26, 2015 at 19:47
  • I gave you already explanation: read Jan Vlcinsky post from stackoverflow link.
    – Abc Xyz
    Jul 2, 2015 at 9:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .