Can a Rule watch the logs

Can a Rule watch logs for spotting errors via a filter / Event
and re log details to a file for later debug ?

Someone was working on a binding to do this at some point. I don’t know what state it made it to.

There was also a long thread where this was discussed but I can’t find it any longer. Perhaps if you spend more than two minutes searching for it you can find it as well.

There really isn’t a way to do this from Rules. You will need something external to tail the log and filter based on whatever criteria you want and publish those lines to OH using OH’s REST API or MQTT.

However, from what you are describing, you probably only need to configure the logging to put those log statements in separate files in the first place. See Log4j2 Sample Config

You can put logs from separate bindings down to logs from individual Rules into separate files through the config.

1 Like
3 Likes

@rlkoshak, state of the LogReader binding is that a pull request is made over a month ago. @pauli_anttila finalized it really nicely and you can extract whatever you want from different logs. Trigger channels and all :wink:

2 Likes