Help getting Log filtering in OH 3 to work

Hello all,

I have OH running in a docker container. I recently upgraded to OH3 and this issue is driving me nuts. I have an MQTT message coming in every second with a lot of data that I really want to filter out of the logging to make it readable.

For now I’ve only created 3 channels from this one message and before creating more I first want to be able to filter them out. The three I have created are the following:

16:35:58.922 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MeterkastESP_VP2' changed from 226.0 to 225.8
16:35:58.923 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MeterkastESP_VP1' changed from 222.4 to 222.3
16:35:58.923 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'MeterkastESP_VP3' changed from 225.8 to 225.7

I’ve seen and implemented the solution as mentioned here (Log filtering in OH 3) but for some reason it does not seem to be working.

I’ve changed log4j2.xml to the following:

<!-- Event log appender -->
<RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i" name="EVENT">
          <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
          <RegexFilter onMatch="DENY" onMismatch="ACCEPT" regex=".*(MeterkastESP_VP).*"/>
          <Policies>
                 <OnStartupTriggeringPolicy/>
                 <SizeBasedTriggeringPolicy size="16 MB"/>
           </Policies>
</RollingRandomAccessFile>

I’ve tried to add the filter to both the “logfile” and “event” appender and I’ve tried all kinds of regex combinations but nothing seems to work.
I noticed that the order behind <RegexFilter is different from the ones in the post I mentioned earlier (no idea if that matters) but after restarting OH (or restarting the container in my case) the order is automatically set to what I have now.

Any help is much appreciated!

https://community.openhab.org/t/log-filtering-in-oh-3/110376/8

Here you go:

Unless I would get problems with the size of my log files I would usually rather filter in a grep statement when I’m searching for something than filtering the log entries in the first place.

But of course this is just my point of view and there is nothing wrong with your approach. It might just be worth considering.