tell application "IndigoServer"
set eventLogDump to build event log list line count 100
send email to "foo@foo.com" with subject "Event Log" with body eventLogDump
end tell
cd "/Library/Application Support/Perceptive Automation/Indigo 4/Logs"
cat *.txt | tr '\r' '\n' > all.log
grep 'homeTemperature' all.log > temps_only.log
rm all.log.gz ; gzip all.log
( cat temps_only.log ; uuencode all.log.gz all.log.gz ) | mail -s "Home Event Logs" me@mydomain.com
tell application "Finder"
set pth to "MacMini HD:Library:Application Support:Perceptive Automation:Indigo 5:Logs:" as alias
set filelist to files in pth
set filelist to sort filelist by modification date
set theText to name of first item in filelist
set theText to (pth as string) & theText as alias
set theContent to read theText
end tell
do shell script "echo " & quoted form of theContent & " |mail -s 'Indigo Log' emailaddress@gmail.com"
chrismoore wrote:I'm not sure if you'd call this easy... But, it's not too hard to run a shell script to grep the actual log file for the messages you want and then mail the result of the shell script. Pretty straight forward in AppleScript, something like:This is great! Does anyone know if there is a way to email a log of just the error messages?
berkinet wrote:I'm not sure if you'd call this easy... But, it's not too hard to run a shell script to grep the actual log file for the messages you want and then mail the result of the shell script. Pretty straight forward in AppleScript, something like:set errorLines to do shell script "/usr/bin/grep error <path to the log file>"
send email to "me@foo.com" with subject "Error Lines "with body errorLines
Change "error" to the string or regular expression you want, and change the path. I'm on my iPad so I can't check it right now.
chrismoore wrote:...If you get a chance to test it out and get it working I would really appreciate it!
tell application "IndigoServer"
set myAddress to "foo@bar.com"
set mySubject to "Indigo Log Error Report"
set logFile to "/Library/Application Support/Perceptive Automation/Indigo 5/Logs/indigo_log.txt"
set errorLines to do shell script ("/usr/bin/grep -i error \"" & logFile & "\"")
send email to myAddress with subject mySubject with body errorLines
end tell
support wrote:.You should be coding the example scripts in python. I know you know the language now.
indigo.server.sendEmailTo("foo@fooville.com", subject="log errors", body="hello there")
indigo.server.sendEmailTo("foo@barcom", subject="log errors", body=os.popen('/usr/bin/grep -i error "/Library/Application Support/Perceptive Automation/Indigo 5/Logs/indigo_log.txt"').read())
myAddress = "foo@bar.com"
mySubject = "Log Error Report"
logFile = '"/Library/Application Support/Perceptive Automation/Indigo 5/Logs/indigo_log.txt"'
errorLines = os.popen('/usr/bin/grep -i error ' + logFile).read()
indigo.server.sendEmailTo(myAddress, subject=mySubject, body=errorLines)
Users browsing this forum: No registered users and 4 guests