LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-28-2008, 03:46 PM   #1
john89011
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
need script to detect log file max limit


Hello...

Can some one help me out on a script that will monitor log file size in ksh. Once it reaches the log file size limit or close to it, it should create a new log file and send out an e-mail stating that it reached max limit and created new file. Log file name is usually xxxx.0228 so when it creates new file it should be something like xxxx_1_.0228 or something. Any help would be greatly appreciated!

Thanks!
 
Old 02-28-2008, 04:36 PM   #2
jasohl
Member
 
Registered: Oct 2006
Location: Seattle, Washington
Distribution: Gentoo, LinuxMint, Arch Linux
Posts: 99

Rep: Reputation: 18
check out logrotate, might be all you need
http://iain.cx/src/logrotate/
 
Old 02-28-2008, 05:27 PM   #3
john89011
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
thanks jasohl! This looks confusing, I am not an expert on this stuff
 
Old 02-28-2008, 05:37 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you look in /etc/logrotate.d (need to be root to create one) you'll see plenty of real uses that you can use as guidelines, along with the manual eg man logrotate.
This is definitely the preferred method for what you want to achieve.
Just ask here if you get stuck.
FYI, logrotate scripts are called from /etc/cron.daily/logrotate.
HTH
 
Old 02-29-2008, 10:03 AM   #5
john89011
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Hi Chris, you're saying I "need to be root" however I am unable to... any other suggestions?
 
Old 03-02-2008, 05:42 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Craft your logrotate 'script', then ask your local admin to check and install it. If this is a prod system, he/she shouldn't have a problem.
 
  


Reply



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 file size limit 2.1gb saurabh parli Linux - Software 6 06-18-2007 11:32 AM
Limit log file size Kevad Linux - General 6 09-28-2006 03:01 AM
VFS: file-max limit 25241 reached Toadman Mandriva 1 05-19-2005 10:39 PM
Threads - Max Limit socratesinus Linux - Software 5 04-20-2005 03:43 PM
RH 7.1 can't detect my modem ... in dmesg log file. t0dd Linux - Software 1 03-04-2002 08:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration