Author Topic: HOW TO: Automate your ISY logs  (Read 1197 times)


  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
HOW TO: Automate your ISY logs
« on: December 21, 2011, 02:20:57 am »
Here is a script to automate your ISY logs.  Use it in combination with a recurrence pattern to automatically backup and then purge your ISY logs. In this example the files are date stamped, saved on a server share folder, and then the user is notifed of task completion.

Code: [Select]
//Stores the current date for use in the file name
strDate = new DateTime().ToString("MM-dd-yy");
//Downloads ISY log and saves as text
txtIsyLog = http.RetrieveWebPage(@"http://Your ISY IP:Your ISY Port/REST/log", @"Your ISY UserName", @"Your ISY Password");
//Creates a file from the text
filesys.WriteFile(@"\\Server\Automation\ISY Logs\IsyLog " + strDate + ".txt", txtIsyLog);
//Clears the log file in your ISY
http.RetrieveWebPage(@"http://Your ISY IP:Your ISY Port/REST/log?reset=true",  @"Your ISY UserName", @"Your ISY Password");

//Basically same thing again, except now for the error log.
txtIsyLog = http.RetrieveWebPage(@"http://Your ISY IP:Your ISY Port/REST/log/error", @"Your ISY UserName", @"Your ISY Password");
filesys.WriteFile(@"\\Server\Automation\ISY Error Logs\IsyLog " + strDate + ".txt", txtIsyLog);
http.RetrieveWebPage(@"http://Your ISY IP:Your ISY Port/REST/log/error?reset=true",@"Your ISY UserName", @"Your ISY Password");

//Send email to notify user
emailsender.SendEmail(@"", @"Subject: Isy Logs", "Isy logs have been backed-up and cleared from the ISY system.");
I always wanted to be somebody. In retrospect, I think I should have been more specific.