Solaris / OpenSolarisThis forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
my application logs grow at very high rate, i dont know how to use log rotation for those in solaris.
What i want is that:
When the log file size exceeeded 300 mb i want to make it empty.
have you tred to remove it with rm in crontab? maybe you will need then to replace it with empty log file.
Could you elaborate a bit on what you mean? I don't see the relationship between disabling logrotate in cron and replacing a log file. But maybe that's just me. If you don't have anything constructive to add, please don't post.
Last edited by EricTRA; 02-03-2012 at 12:39 AM.
I thought he want to make some free space periodically.
I think I understand what you meant. You advised the OP to periodically run the rm command to just bluntly remove a log file in order to free up space. I misunderstood your post in that sense that I thought you were talking about disabling logrotate in cron.
Just bluntly removing a log file to free up space is very bad practice since you might need the log file later on when looking into errors! If diskspace is filling up with excessive log generation then you should look into rotating the logs, including compression, and look into WHY so much logs are being generated. Most likely there's some error or situation that needs to be fixed. If there is no error at all and you still get a lot of logs, then you might have set your partition size too small in which case you'll need to adjust that first.
Thanks for replying.
Thing is this my log file size goes upto 3 gb, and everything hangs after that and the space problem comes every next day.
So i want to rotate the logs and i want that only 2 file remains in the server
one which is old(size max-300 mb)
second which is generating logs(size max-300 mb)
As indicated in my previous post, is there a known reason why you are generating so much log? Did you put something in debug mode and forgot to remove the debug option? Have you had a look at:
1. The links I posted?
2. If you have logrotate installed or not?
3. Research anything using Google?
Yes debug is on because i have few daemons running where some trasaction got stuck and we have to tail the logs.
we dont have logrotate install i dont know how to install it?
i research google but didnt get anything usefull.
Basically the logadm information is kept in /etc/logadm.conf if you don't have to kill or nohup any processes that are holding open the filesystem a simple 'logadm -C <#ofcopies> -S <size> /path/to/log' is all you need.
one thing to be aware of, logadm is typically run from root's cron file so check it for how often it needs to run if you're generating a GB of logs in a day and only wanting to keep 300m and cron only executes it once a day you'll still be hitting a GB before it rolls.
Last edited by Blinker_Fluid; 02-06-2012 at 12:58 PM.