Is there a way where I can create a way (i.e. sensor) that tracks the amount of errors that show up in the logs? Similar to the Watchman reporting tool that shows the volume of issues with entities (i.e. unavailable…).
I have defined a counter
counter:
sys_log_counter:
restore: false
And an automation that manages the counter based in events:
- id: sys_log_counter
alias: sys_log_counter
mode: queued
trigger:
- platform: event
event_type: system_log_event
event_data:
level: WARNING
- platform: event
event_type: system_log_event
event_data:
level: ERROR
- platform: event
event_type: call_service
event_data:
domain: system_log
service: clear
action:
- choose:
- conditions: "{{ trigger.event.event_type == 'system_log_event' }}"
sequence:
- service: counter.increment
target:
entity_id: counter.sys_log_counter
- conditions: "{{ trigger.event.event_type == 'call_service' }}"
sequence:
- service: counter.reset
target:
entity_id: counter.sys_log_counter
5 Likes
Awesome, thank you! Exactly what I was looking for
1 Like
Thanks! This is great!
1 Like