Announcement

Collapse
No announcement yet.

Simple Log Rotation Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rbrun
    replied
    I have pretty much converted my whole web interface for HS to an IIS/ASP version so it really never occured to me to clear the memory log. My ASP page that reads the log just gets the one on the disk. Which was a real problem without the rotatelog script.

    That was just an oversite on my part for those of you who use HS's web server.

    Adding the hs.Clearlog that was mentioned above should fix you up though.

    Rob

    Leave a comment:


  • Guest's Avatar
    Guest replied
    thanks, I think I'll try just adding that to the last line of the script, and see what happens tonight.

    Leave a comment:


  • kenm
    replied
    DaveB,

    Create a small script called Clearmemlog.txt:

    Run this script just before you run your script to rotate your disk log files and your memory logs will be in sync with your disk log files.
    It could even be run from the same event.

    I suppose this could be added as an option to the rotatelog script?

    HTH,
    Ken

    Leave a comment:


  • Hunter Green
    replied
    The scripts are only working with the log file on disk, but the display log remains untouched. This can actually be very convenient.

    Nucleus Home Automation

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Rob,
    I need a little bit of clarification as to what is happening here. I've implemented your script setting up an event which triggers daily at 11:59 pm. It creates the new dated log file and copies the log over. The ah.log file gets cleared out and starts with that new days log activities....all of this what I would have expected.

    However, the HS log (viewed by clicking the log button on left view pane) does not show just that day's log....it shows the whole log from the last time HS was started (or I had hit the clear log button). I would have expected that it would show the same thing as the ah.log file. I've gone back out to an event and status view and then back into log view....but it still shows the complete older multiple day log file.

    Is this working as designed, or did I miss a step in installation some how? After creating and copying over the new daily log file, should the script issue a clear HS log command of some sort? If not, how do you clear the HS log to get rid of the prior days activities, without loosing some of the current day activities?

    standard HS build 10, w/2000

    Leave a comment:


  • djanse
    replied
    I guess it's just like anything else. YOU JUST NEVER KNOW... [img]/infopop/emoticons/icon_rolleyes.gif[/img]

    -Dave-

    Leave a comment:


  • Rupp
    replied
    ...why are we backing these up? I seem to back them up and never, I mean never, go back and use them for anything. What do you guys do with your log files?

    -Rupp

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Rob,
    Thanks for the script, working great!

    Huggy,
    For some reason I can't get to your site, perhaps it's down. I'd like to take a look at your monthly zip script.

    Leave a comment:


  • huggy591
    replied
    If anyone is interested, I created a set of log file rotate and archive scripts a while back. The archive script uses your choice of a command-line compression util to periodically "zip" up all logs into a date-named archive file for storage. Also works with HSP logs.

    I run my log rotator each night, and the archive script on the 1st of each month. The archive script compresses all of the previous month's logs, as rotated nightly to the date-named log file, into a nice compact archive. Save your disk space!

    They should be available on the Home Automation section of my site, www.gordoncunningham.com - click the Gordon's Site link on the opening page and then the Home Automation button.

    - huggy

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Thanks Rob

    I dont really worry about the date thing. I would never see something like that. I can hardly go 2 weeks without formatting harddrives and starting over. I like things to run at top speed. And formatting does that. [img]/infopop/emoticons/icon_smile.gif[/img]

    Eric Trudeau
    | E-mail | HomeSeer Status |

    Leave a comment:


  • rbrun
    replied
    I could have been more discript with the install text, at the time I just threw it up there because I saw that someone was wanting something like that. Sorry about that guys.

    To change the timestamp order that is used in the name, change the order of the blocks between lines 41 through 49. To get day, month, year it would look like this:

    str = pre
    strTemp = DatePart("d",strDate)
    if (0 + strTemp) < 10 then strTemp = "0" & strTemp
    str = str & strTemp

    strTemp = DatePart("m",strDate)
    if (0 + strTemp) < 10 then strTemp = "0" & strTemp
    str = str & strTemp

    str = str & Right(DatePart("yyyy",strDate),2)


    Here's a old IT guy tip as to why I did year, month, day.... after the first year when you sort by filename in the directory you want to keep your years together rather than your days or months. Remember how Windows sorts files, it will be left to right.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    <BLOCKQUOTE><font size="-1">quote:</font><HR>Originally posted by Rob Brun:
    Did you create the OldLogs directory in your HomeSeer directory?<HR></BLOCKQUOTE>

    ahh thanks!


    How would I modify the file to have the file name be hs(day)(month)(year)?

    as in hs230102.log

    thanks

    Eric Trudeau
    | E-mail | HomeSeer Status |

    Leave a comment:


  • djanse
    replied
    Just a suggestion, how about a more detailed installation text. I know that some (like myself)muddle thru the script and eventually get things working. Thank you for the great work.

    -Dave-

    Leave a comment:


  • DSteiNeuro
    replied
    Very Nice!!!

    Leave a comment:


  • rbrun
    replied
    Did you create the OldLogs directory in your HomeSeer directory?

    Leave a comment:

Working...
X