logrotate size limit


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users logrotate size limit
# 1  
Old 10-30-2008
logrotate size limit

Hi
i configured log rotate for a specific file.
/var/log/sauer

i configured create a file in logrotate.d
[root@ci logrotate.d]# cat /etc/logrotate.d/sauer
#this is a logrotate configuration file for msu_ng logs

/var/log/sauer {
rotate 5
size=1M
daily
compress
postrotate
/usr/bin/killall -HUP syslogd
endscript
}

then i update the file by using l"ogrotate -f /etc/logrotate.d/sauer"
then i test the new log with IO(while true ; do echo "blabla" >> /var/log/sauer ;done)
i dont understand why the log size is getting larger then 1MB (as you can see i configured size=1M)? do you know why the size limit didnt effect.
# 2  
Old 10-30-2008
The limit is only checked after the next invocation of logrotate. So, make it bigger than 1 MB, THEN run logrotate. Also, remove the = sign. This might prevent the script from properly seeing the "size" option.
# 3  
Old 10-30-2008
so is there any way to limit the exact log size ?
# 4  
Old 10-30-2008
Well, you can run logrotate with high granularity -- every minute using a cron job. Or, you can pipe the output of your process to [i]rotatelogs[i], a program that comes with apache:
Code:
 some_process 2>&1 | /usr/sbin/rotatelogs /var/log/sauer 1M

# 5  
Old 10-30-2008
thanks
one last thing
do you know what is the option that related to the first rotation.
mean if there is compress it wont effect the first rotate log(like messages.1).
cheers
# 6  
Old 10-30-2008
delaycompress
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

logrotate irrespective of the size of a file/directory

hi, How to logrotate irrespective of the size of a file/directory...? Please help me in this regard... (4 Replies)
Discussion started by: Dedeepthi
4 Replies

2. UNIX for Dummies Questions & Answers

Directory size limit

Hey everyone I'm trying to limit the size a directory can be under Solaris 10. I can find plenty of guides to do it for user home directories, ut what I'm after is an absolute limit, regardless of the user. For example: I want /export/example/ to never pass say 5 GB, no matter what user is... (3 Replies)
Discussion started by: goodvikings
3 Replies

3. Shell Programming and Scripting

Limit on a File size.

Hi All, I want to store 32KB of file in Oracle DB into CLOB field. I am not able to insert more than 32KB of file into CLOB. So i want to put a limit on the file size. I am using k shell. My file size will dynamically increase its size, i want to check the file size if it is more than 32KB... (1 Reply)
Discussion started by: rajeshorpu
1 Replies

4. Ubuntu

logrotate - why ignore size ?

Hi, i have a logroate script that works properly when running manually but otherwise it won't work.I put in in /etc/logrotate.d/nginx. I simply cannot understand why it won't run properly when run with a cronjob. It suppose to run hourly and rotate logs if they are > 3mb. What am i missing here ?:... (1 Reply)
Discussion started by: ktm
1 Replies

5. Linux

Limit directory size

Hello I want to limit the size of a directory; so a user cant copy more staff inside it then 5 Giga for example.. eg. /nfs/temp/jhon size can not increase more that 5Gb I havnt found anything on the net. Is there a way to do it? (2 Replies)
Discussion started by: jredx
2 Replies

6. UNIX for Dummies Questions & Answers

how to set size in logrotate.conf

Hi,guys: recently,i am puzzled by a question .when i create a new file named by /etc/logrotate.d/debug. The cont. is listed as follow: /var/log/debug { rotate 3 missingok notifempty size=2k prerotate /bin/kill -HUP `cat... (0 Replies)
Discussion started by: icehero
0 Replies

7. UNIX for Dummies Questions & Answers

can I limit the size of a directory?

Hi, I am not root, but I need to limit the size of my directory, so that it cannot contain more than 200M of stuff inside. Is this possible? Also, how can I see the total size of that directory? If I do ls -ltrd, it does not give me the size of all the files inside the directory. And if I do df... (6 Replies)
Discussion started by: JamesByars
6 Replies

8. UNIX for Dummies Questions & Answers

Limit Folder Size

Is there a way to limit a certain folder size(e.g. Documents, Desktop)? :) (2 Replies)
Discussion started by: tisdmin
2 Replies

9. Solaris

File size limit

I want to have a permanent file created - and limit the size that this file can grow.. I want a circular file.. ie max size of file is 10 mb.. and if any new data written to file the oldest data removed.. How can I do this? I am on solaris 9 x86 (3 Replies)
Discussion started by: frustrated1
3 Replies

10. UNIX for Dummies Questions & Answers

Limit size of the file

How do I limit size of a file to 1 MB or something like that under Linux? (4 Replies)
Discussion started by: _hp_
4 Replies
Login or Register to Ask a Question