[SOLVED] Filter log messages

logging
Tags: #<Tag:0x00007f15d711d598>

(Maximilian) #1

I want to filter these log messages:

2018-07-09 18:29:29.049 [ERROR] [lfe.hap.impl.http.impl.BinaryHandler] - Exception in binary handler
java.io.IOException: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [232:org.openhab.io.homekit:2.3.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2018-07-09 18:29:29.069 [ERROR] [.hap.impl.http.impl.AccessoryHandler] - Exception caught in web handler
java.io.IOException: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [?:?]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [?:?]
	at sun.nio.ch.IOUtil.read(IOUtil.java:192) [?:?]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [?:?]
	at io.netty.buffer.UnpooledUnsafeDirectByteBuf.setBytes(UnpooledUnsafeDirectByteBuf.java:447) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:880) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [232:org.openhab.io.homekit:2.3.0]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [232:org.openhab.io.homekit:2.3.0]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I tried adding the following to the /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg file, but it doesn’t work:

log4j2.appender.event.filter.floodstop.type = RegexFilter
log4j2.appender.event.filter.floodstop.regex = .*(Exception in binary handler|Exception caught in web handler).*
log4j2.appender.event.filter.floodstop.onMatch = DENY
log4j2.appender.event.filter.floodstop.onMisMatch = ACCEPT

Now I thought it could be the spaces in there, but even a filter without spaces doesn’t work:

log4j2.appender.event.filter.floodstop.type = RegexFilter
log4j2.appender.event.filter.floodstop.regex = .*(Wartezeit|Kommunikationspartner).*
log4j2.appender.event.filter.floodstop.onMatch = DENY
log4j2.appender.event.filter.floodstop.onMisMatch = ACCEPT

Can somebody help me filtering out these log messages?


(Vincent Regaud) #2

Did you add these lines to the end of the # Event log appender section?


(Maximilian) #3

Yes I have. This is the section, now with “Verbindung” as regex:

# Event log appender
log4j2.appender.event.type = RollingRandomAccessFile
log4j2.appender.event.name = EVENT
log4j2.appender.event.fileName = ${openhab.logdir}/events.log
log4j2.appender.event.filePattern = ${openhab.logdir}/events.log.%i
log4j2.appender.event.immediateFlush = true
log4j2.appender.event.append = true
log4j2.appender.event.layout.type = PatternLayout
log4j2.appender.event.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c] - %m%n
log4j2.appender.event.policies.type = Policies
log4j2.appender.event.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.event.policies.size.size = 16MB
log4j2.appender.event.filter.floodstop.type = RegexFilter
log4j2.appender.event.filter.floodstop.regex = .*(Verbindung).*
log4j2.appender.event.filter.floodstop.onMatch = DENY
log4j2.appender.event.filter.floodstop.onMisMatch = ACCEPT

(Vincent Regaud) #4

I have exactly the same set-up
That’s for the event log

Add the same thing to the #Rolling fIle appender
That one is for openhab.log


(Maximilian) #5

Now it’s working. Thanks!


(Vincent Regaud) #6

Cool, please mark the solution.
hc_292