I would like to send all HA logs and events to an external log aggregator that can receive HTTP calls (specifically Axiom, but it does not matter much).
To do this, I wanted to set up an automation that would trigger on each event (an empty trigger of type “Event”) and an action based on the RESTful command.
I created an entry in configuration.yaml for that but I do not know what to put in the payload entry to have it filled in with the content of the event that triggered the automation.
Is this something possible to do? Or maybe there are better alternatives to send events to external aggregators?
However, you do realise that this automation is going to create events, that will trigger this automation that will generate events that will trigger this automation etc…
In other words this is a very bad idea.
I once made an automation to send logged errors to my telegram account. Unfortunately the automation was poorly written and generated errors. Which triggered the automation, which generated errors, etc…
I Managed to bring home assistant to a grinding halt in a matter of a minute or so.
I wonder if a specific condition would not be enough, in other words, if just entering the automation triggers an event, or if this event is generated only if the automation actually runs until the end (i.e. does not exit on a condition). I will test this out before going further.
EDIT: good, looks like a failed condition in an automation does not trigger an event for that automation
Although it’s common to say an automation is triggered when one of its triggers is triggered (say that three times quickly), in actuality the automation is officially triggered when one of its triggers is triggered and all its conditions are fulfilled. That’s when the value of the automation’s last_triggered property is updated and the automation procceds to execute its actions.
Correct. If its conditions aren’t fulfilled, the automation hasn’t officially triggered and the value of its last_triggered property remains unchanged.
Yes, this is what I am calling (or actually: trying to call as I am working on this as we speak and have problems with transferring the payload of the event to the body of the POST) to send the data to Axiom.
I am writing an automation called “datacenter ⬤ send all events to Axiom”. This automation
triggers on any event (for now I am testing on a ad-hoc event I am sending from Dev Tools)
checks a Template Condition {{ trigger.event.data.name != "datacenter ⬤ send all events to Axiom" }}
use RESTful to make a HTTP call to the log aggregator (I am still having problems to put the contents of the trigger (per your link) to the body of the POST)