Page 1 of 1 1
Topic Options
#140097 - 2005-05-20 11:55 PM 8 days worth of logs
operez Offline
Getting the hang of it

Registered: 2003-08-08
Posts: 75
I need to verify that all portions of my script are being executed each and every time the script runs, so I am creating a log file to log each step. I currently write out the time and date the script starts and ends, but the log file is getting big. I would like to read through the log and keep only the last 8 days worth. Has anyone done something like this, so that I don’t have to reinvent the wheel or how easy would this type of task be?

Thanks.

Top
#140098 - 2005-05-21 12:28 AM Re: 8 days worth of logs
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You should start a new log every day and then it would be easy to delete any more than 8 days old.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140099 - 2005-05-21 02:37 AM Re: 8 days worth of logs
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
You can also review these posts for further information on the subject.

how to scrub a file
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=134953

delete files by date
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=137548

 

Top
#140100 - 2005-05-25 09:21 PM Re: 8 days worth of logs
operez Offline
Getting the hang of it

Registered: 2003-08-08
Posts: 75
Thanks, for your reply. I think I will try to write something using the readfile(), search for the dates required and then writefile() to a temp file, then replace the original file.
Top
#140101 - 2005-05-26 12:31 AM Re: 8 days worth of logs
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, do it the hard way.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140102 - 2005-05-26 12:52 AM Re: 8 days worth of logs
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
I agree with Les, new one each day then use maybe Robocopy to remove archived files
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#140103 - 2005-05-26 11:38 PM Re: 8 days worth of logs
operez Offline
Getting the hang of it

Registered: 2003-08-08
Posts: 75
OK, OK, what was I thinking. (I think there's a song like that.)
I thought it would be a good way to learn something new, but as a newbie I don't have days and days to try an figure this one out.
Thanks anyway.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.056 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org