The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sort files by date, delete oldest, if total size bigger than scarfake Shell Programming and Scripting 2 05-21-2008 05:02 AM
Find file size and date gsusarla UNIX for Advanced & Expert Users 10 04-08-2008 02:33 PM
How can i delete files in folder by date? kobibn UNIX for Dummies Questions & Answers 9 10-25-2007 03:04 PM
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 03:48 AM
how to delete files by date jamesbond UNIX for Dummies Questions & Answers 2 10-12-2001 07:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-14-2002
Registered User
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Question Delete file by date or by size

Hi Everyone,

This forum has been a great help to me as a new newbie in Unix. Thanks to you all.

My ? now is I have a log file that help me keep track of errors within my program. But the size of the log file keeps growing and I am wondering if there is any command that will help me to limit the size of the log file to about 10,000 lines. Or since I capture both the date and time stamp and the error message, is there anyway I can write a code to help keep up to say about 10 days of error within my log file.

Thanks for your help.

Odogbolu98
Reply With Quote
Forum Sponsor
  #2  
Old 03-14-2002
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 490
One suggestion may be that every 10 days that you swap files.
Hence you'd have two files at anyone time providing 20 days of log details (~/LogFile-A & ~/LogFile-B). Every 10 days swap between the two...for instance.

1/ Currently on LogFile-A
2/ 10 Days later swap to LogFile-B
3/ 10 Days later empty LogFile-A and swap to LogFile-A
4/ 10 Days later empty LogFile-B and swap to LogFile-B
5/ ** Keep rotating through steps 3 & 4.

Just a thought.
Quote:
any command that will help me to limit the size of the log file to about 10,000 lines
Try: cat LogFile-A | wc -l
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0