Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi,
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.
Regards,
Parteek Makkar
have you tred to remove it with rm in crontab? maybe you will need then to replace it with empty log file.
Hi,
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.
Kind regards,
Eric
Last edited by EricTRA; 02-03-2012 at 12:39 AM.
Reason: Typo
I thought he want to make some free space periodically.
Hi,
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.
Hi all,
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.
I think you should review your 'searching skills'. Google turned up the following in a few seconds. If you don't have logrotate installed nor know how to install it, you could use logadm which comes as standard tool as from Solaris 9. Log rotation in Solaris using logadm Custom logrotate in Solaris 10
I think you should review your 'searching skills'. Google turned up the following in a few seconds. If you don't have logrotate installed nor know how to install it, you could use logadm which comes as standard tool as from Solaris 9. Log rotation in Solaris using logadm Custom logrotate in Solaris 10
Kind regards,
Eric
What he said.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.