Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-11-2012, 08:55 AM   #1
LQ Newbie
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
Need help in using linux utility logrotate

Hi All,

I have to make a utility that can monitor a log file and if it reaches some size (say 1k), it should create another file in rotation and compress and zip it. I want to use existing utility of Linux like logroate. But logrotate is not working properly here. Can any body tell me the reason.

Folllowings are logroate configuration

linux system kernel

I am modifying /etc/logrotate.conf like this

/rmem/slave //file name
missing ok
size 1k
rotate 4

According to above configuration, logrotate should monitor the file /rmem/slave, once the file reaches its size 1 kilo byte, it should create new file and conpress and zipped it like slave.1.gz.
in ths same way it should create slave.2.gz, on reaching another 1 kilo byte in the same way slave.3.gz should also be created once size reaches another 1k,and similarly slave.4.gz

My Question is here this size command is not working properly in logrotate.conf

i have mentioned here 1k, but it is not creating zip file after /rmem/slave reaches 1k,but when it reaches 100k -200k, then it is creating the new file. and also it is creating the zip file of 10k sometime 9k, sometime 11 k

I am not understanding the behavior of size in logrotate.conf

Can any body help me?
Old 03-11-2012, 09:01 AM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
logrotate is normally run daily
Old 04-09-2012, 04:10 PM   #3
LQ Newbie
Registered: Jan 2005
Location: Midwest
Distribution: Debian
Posts: 6

Rep: Reputation: 0
Small Sizes

When you are talking about 1 kilobyte you are referring to a very small amount of data. My guess is log rotate is getting confused and not able to function as your file size designated is way to small thus it might be trying to force itself into to many actions too fast. Hence the 100-200k.. My belief at this point is logrotate has a limit on the minumum size of file it can work with but I'm only speculating on this. Now if you said 1 MB or 100Kilobyte, this might allow it to work properly.

I would do a search and look for something along the lines of "what is the minumum file size logrotate can operate on".. This may or may not provide some clues.

Best of luck on that one.


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
[SOLVED] logrotate or logrotate.conf; problems with sftp slufoot80 Linux - Server 1 11-05-2011 07:50 AM
Utility for Disk Usage / Treesize utility teknoratti Linux - Software 1 06-08-2011 02:53 AM
Help with a linux utility Ripper951 Linux - General 6 01-12-2003 01:00 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:41 AM.

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