So for those that want an OH3 filter that does as the first post asks with a simple cut and past solution try this example. (OpenHabian on Raspi 4 OpenHAB 3.2.0)
To filter out an entry in the log like:
2022-04-30 18:55:21.231 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SqueezeBoxReceiverCurrentPlayingTime' changed from 227 to 228
Then edit /var/lib/openhab/etc/log4j2.xml
...
<!-- Event log appender -->
<RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i" name="EVENT">
<!-- Regex Filter added below -->
<RegexFilter regex=".*CurrentPlayingTime.*" onMatch="DENY" onMismatch="ACCEPT"/>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="16 MB"/>
</Policies>
</RollingRandomAccessFile>
...
An example to filter out:
2022-04-30 19:07:05.368 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'ZWaveSerialControllerSerialSof' changed from 2489 to 2490
would be:
<RegexFilter regex=".*ZWaveSerial.*" onMatch="DENY" onMismatch="ACCEPT"/>
There can be only one filter line! So a compound filter to remove both log lines uses the OR operator and looks like:
<RegexFilter regex=".*CurrentPlayingTime.*||.*ZWaveSerial.*" onMatch="DENY" onMismatch="ACCEPT"/>
A good resource: https://logging.apache.org/log4j/2.x/manual/filters.html