How to get last rule for a triggered event. possibility to search over all rules inside OH3

Hi all, I use openhab 3.1.0 on a raspberry 4

I have migrate all rules files from OH2.5 ino inside of OH3 via Main UI.

Now I have the problem that some trigger are starts and I don’t know from which rule. For the diagnostic part I need a “simple” way to figure out which rule has fired an event. Otherwise I must write a log record in each rule to the begin and this isn’t really “state of the art” - I have 160 rules and the io rate will be grow up.

Second is there any possible to find a item over all rules ? if these are located in files I can use the search functionality of the editor. Actual I have no clue how.

many thanks
Christian

Open $OH_USERDATA/etc/log4j2.xml and change the logging level for RuleStatusInfoEvent to INFO instead of ERROR. You can do this through the karaf console too.

Alternatively you can open the developer sidebar in MainUI (alt-shit-d) and watch the full event stream which includes events when rules run.

It’s still files, in particular $OH_USERDATA/jsondb/automation_rules.json.

Because it’s a JSON structure that is “pretty printed” for human consumption grep won’t work very well but you can open it in a viewer/editor of choice and search through that way. Note that there are other places an Item can appear including links, metadata, widgets, etc. Also, there are ways for a rule to interact with an Item without the name of the Item ever appearing in the rule.

2 Likes

Hi Rich,
many thanks, good idea - forgot that there is the developer sidebar :slight_smile: Here I must go more in detail. Further i will check the json file - i think this helps.

thanks again and best regards,
Christian

THIS IS BRILLIANT - i had the same problem with an item amongst 200+ rules doing the wrong thing - a search across the JSON file and I found it!

Thank you!