--- [EMAIL PROTECTED] wrote:
I looked at the file scripts at both rebol.org and rebol.com without
finding any similar routine.  I assume I "load" the log file; but I have no
idea how to get rid of the lines I don't want.  

                                                - fleet -     
--- end of quote ---
You'd probably want to make your script in several pieces.  The first would use 
read/lines to read the apache logfile (which has 1 record/line) and save back to the 
log file the data without previous days' entries.  Depending on what you're trying to 
do, you might just delete the orig log file if you're doing this every day.  
Here's the hard part: after changing the log file (which presumably takes so little 
time that at most only an access or two are lost) you need to do an apachectl restart. 
 This would be something for rebol/command.  Or, if you can stand to lose a minute of 
logging/day, you might make a cron entry 1 minute after calling your rebol script 
restarts apache.  

In this situation you would have 2 cron entries, maybe a minute apart and a script 
like the following:

REBOL []
today: make block! []
notoday: make block! []
foreach entry read/lines %logfile [
        either find entry now/date [
                append today join to-string entry {^/}
        ][
                insert notoday entry
        ]
]
write %logfile today
;this should take very little time.  around here is when your other cron entry should 
restart apache or rebol/command could do it.

; here you can parse/sort/save/whatever the entries from previous days.


Something of this form (though not this exact code.  now/date may not be in the right 
format, for example) should do it.

--
Andrew Grossman

Reply via email to