LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 02-03-2012, 12:04 AM   #1
parteekM
LQ Newbie
 
Registered: Feb 2012
Posts: 5

Rep: Reputation: Disabled
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
 
Old 02-03-2012, 12:16 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
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
A quick search also turned up this. I'm sure Google can come up with a lot more on the subject.

Kind regards,

Eric
 
Old 02-03-2012, 12:24 AM   #3
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,134

Rep: Reputation: 132Reputation: 132
have you tred to remove it with rm in crontab? maybe you will need then to replace it with empty log file.
 
Old 02-03-2012, 12:36 AM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Quote:
Originally Posted by yooy View Post
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
 
Old 02-03-2012, 12:47 AM   #5
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,134

Rep: Reputation: 132Reputation: 132
I thought he want to make some free space periodically.
 
Old 02-03-2012, 01:25 AM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Quote:
Originally Posted by yooy View Post
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.

Kind regards,

Eric
 
Old 02-03-2012, 04:10 AM   #7
parteekM
LQ Newbie
 
Registered: Feb 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-03-2012, 05:00 AM   #8
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
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
 
Old 02-03-2012, 05:55 AM   #9
parteekM
LQ Newbie
 
Registered: Feb 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-03-2012, 07:32 AM   #10
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
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
 
Old 02-06-2012, 12:55 PM   #11
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
Quote:
Originally Posted by EricTRA View Post
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
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.
 
  


Reply


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
Log rotation for my application logs parteekM Solaris / OpenSolaris 5 02-04-2012 04:25 AM
Log rotation.. Skillz Linux - Server 7 09-03-2011 04:49 PM
How to change Debian log rotation of syslog and daemon.log onmountain Linux - Newbie 2 07-31-2008 02:27 AM
Log Rotation for snort log does not seem to be working CentOS4.5 JasonKretzer Linux - Security 3 06-25-2007 12:25 PM


All times are GMT -5. The time now is 05:43 AM.

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