Log rotation for my application logs
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 |
Hello,
I don't know how it works in Solaris but if you have the logrotate package installed the best place to start would be the man page for logrotate: Code:
man logrotate Kind regards, Eric |
have you tred to remove it with rm in crontab? maybe you will need then to replace it with empty log file.
|
Quote:
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 |
I thought he want to make some free space periodically.
|
Quote:
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. Kind regards, Eric |
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) Please help me. Regards, Parteek Makkar |
Hello,
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? Kind regards, Eric |
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. Regards, Parteek Makkar |
Hi,
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 |
Quote:
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. |
All times are GMT -5. The time now is 07:52 PM. |