I now have multiple filters working in OH 2.5.1.2.
Per @petero’s last post, you have to define the filter attribute, and then add filters to it. I defined “Stuff” and then filled it with filter sets for general
, astro
, ups
, wifi
, and zwave
.
Note that the onMismatch
line in each filter set must be NEUTRAL
. If it’s set to ACCEPT
, the filters will stop evaluating at that point. This stackoverflow link explains it better than I can.
@Schrott.Micha I tried changing the last line to ACCEPT
, and my filter immediately stopped working. Going back to NEUTRAL
fixed it. I can live with the error in the console log file, which I think is a bug in the version of Log4j2 used in openHAB (see this link).
Honestly, there’s no real benefit to this unless your regex string is extremely long and hard to manage…but it’s satisfying if you like things to be grouped together.
# custom filters for events.log
log4j2.appender.event.filter.stuff.type = Filters
log4j2.appender.event.filter.stuff.general.type = RegexFilter
log4j2.appender.event.filter.stuff.general.regex = .*(has been updated|received command|predicted to|through).*
log4j2.appender.event.filter.stuff.general.onMatch = DENY
log4j2.appender.event.filter.stuff.general.onMismatch = NEUTRAL
log4j2.appender.event.filter.stuff.astro.type = RegexFilter
log4j2.appender.event.filter.stuff.astro.regex = .*(morningNight|astroDawn|astroDusk|nauticDawn|nauticDusk|civilDawn|civilDusk|daylight|noon).*
log4j2.appender.event.filter.stuff.astro.onMatch = DENY
log4j2.appender.event.filter.stuff.astro.onMismatch = NEUTRAL
log4j2.appender.event.filter.stuff.ups.type = RegexFilter
log4j2.appender.event.filter.stuff.ups.regex = .*(UPS_Output_Voltage changed|UPS_Runtime changed|UPS_Runtime_Transformed changed).*
log4j2.appender.event.filter.stuff.ups.onMatch = DENY
log4j2.appender.event.filter.stuff.ups.onMismatch = NEUTRAL
log4j2.appender.event.filter.stuff.wifi.type = RegexFilter
log4j2.appender.event.filter.stuff.wifi.regex = .*(Wemo changed|harmonyhub:hub|LED_|_led changed|_rssi).*
log4j2.appender.event.filter.stuff.wifi.onMatch = DENY
log4j2.appender.event.filter.stuff.wifi.onMismatch = NEUTRAL
log4j2.appender.event.filter.stuff.zwave.type = RegexFilter
log4j2.appender.event.filter.stuff.zwave.regex = .*(Alarm_Raw changed|Lock_Battery changed|Zooz changed).*
log4j2.appender.event.filter.stuff.zwave.onMatch = DENY
log4j2.appender.event.filter.stuff.zwave.onMismatch = NEUTRAL