Use log as trigger

Moderator: leecollings

Post Reply
sebaszz
Posts: 1
Joined: Wednesday 30 March 2016 10:03
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Use log as trigger

Post by sebaszz »

Is it possible to trigger event based on result of the log.

I want to have a trigger when "Toon" provides the following error in the log: "Error: ToonThermostat: Error login!"

Can somebody push me in the right direction?
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Use log as trigger

Post by Egregius »

Maybe a huge thing, but I guess fail2ban should do it.
fail2ban can monitor logfiles in realtime and do actions if a string is found.
Normally used to block IP adresses in firewall but the action can be anything you want.
User avatar
jvdz
Posts: 2335
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Use log as trigger

Post by jvdz »

What I have done for my ICY thermostat is to check for the lastupdate of the TempDevice being older than 5 minutes triggering an Telegram message that there is an error.
Guess you could also use fail2ban to scan the log for this and create an action based on it, but is more difficult to do if you want to warned of loosing the connection to your thermostat.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Use log as trigger

Post by Egregius »

If the timestamp gets updated regularly that would absolutely be an easier solution.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest