Filter out discovery logs in openhab.log

Hi everyone,

I am using openHab 4.3.3 with Raspbian and I am very happy with it except about the upnp things that keeps poluting my openhab.log. See below:

2025-03-09 10:51:20.682 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 10:51:20.725 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 10:51:20.804 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 10:51:20.875 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 10:51:20.962 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 10:51:21.030 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:01:37.892 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:01:38.006 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:01:38.164 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:01:52.828 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:01:52.969 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:01:53.140 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:06:21.063 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 11:06:21.080 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:06:21.103 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:06:21.250 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:06:21.283 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 11:06:21.306 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 11:16:39.011 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:16:39.154 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:16:39.319 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffa6c33a37' to inbox.
2025-03-09 11:16:54.019 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:16:54.136 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:16:54.324 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-0000-000077f2f2b1' to inbox.
2025-03-09 11:21:22.068 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:21:22.081 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:21:22.089 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 11:21:22.215 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:21:22.258 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.
2025-03-09 11:21:22.374 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffff8f30c930' to inbox.
2025-03-09 11:21:22.413 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'upnpcontrol:upnprenderer:15376480-fb80-662c-ffff-ffffbeb43981' to inbox.

This represents hundreds of lines every day and I have many ways to get rid of it unsuccessfully.

These thing to exist and are configured in my upnp.things file
Thing upnpcontrol:upnprenderer:garagerenderer “Ampli” @ “Garage” [udn=“769946fc-60b0-4d83-ba55-e415c0edd9ca”, refresh=600, seekStep=1]
Thing upnpcontrol:upnpserver:garageserver “Serveur” @ “Garage” [upnprenderer=“garagerenderer”, udn=“3c24dd1a-557d-418b-ba28-5931deeaddf8”, refresh=120, filter=true, sortCriteria=“+dc:title”]

Thing upnpcontrol:upnprenderer:avrx4000renderer “Ampli” @ “Séjour” [udn=“5f9ec1b3-ff59-19bb-8530-0005cd380f44”, refresh=600, seekStep=1, maxNotificationDuration=0]
Thing upnpcontrol:upnprenderer:TVSalonrenderer “Télévision” @ “Séjour” [udn=“2826f1fe-4ced-4299-aeb3-1e7c795079f0”, refresh=600, seekStep=1, maxNotificationDuration=0]
Thing upnpcontrol:upnprenderer:homeEntreerenderer “Google Home” @ “Pallier” [udn=“15376480-fb80-662c-0000-000077f2f2b1”, refresh=600, seekStep=1, maxNotificationDuration=0]
Thing upnpcontrol:upnprenderer:homeminiMelrenderer “Google Home Mini” @ “Chambre Mélanie” [udn=“15376480-fb80-662c-ffff-ffffa6c33a37”, refresh=600, seekStep=1, maxNotificationDuration=0]
Thing upnpcontrol:upnprenderer:homeminiBureaurenderer “Google Home Mini” @ “Bureau” [udn=“15376480-fb80-662c-ffff-ffff8f30c930”, refresh=600, seekStep=1, maxNotificationDuration=0]
Thing upnpcontrol:upnprenderer:Maisonrenderer “Google Homes” @ “Maison” [udn=“15376480-fb80-662c-ffff-ffffbeb43981”, refresh=600, seekStep=1, maxNotificationDuration=0]

I am using bubbleUPnP server

Do you know how I could get rid of these lines? even if it means filtering all upnp binding messages (I tried it unsuccessfully).

Thank you and kind regards

Olivier

This should get you going:

or disable the UPNP network scan in Settings.

Thank you @sihui

I had tried this (filtering in log4j2.xml) but it did not work.
I am wondering if the filter does not only apply to event.log and not openhab.log
Unless I use the wrong syntax:

           <!-- Rolling file appender -->
            <RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i.gz" name="LOGFILE">

                     <!-- Regex Filter added below -->
                    <RegexFilter regex="*upnpcontrol:upnprenderer:*" 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>
                    <DefaultRolloverStrategy max="7"/>
            </RollingFile>

I have seached for the “disable the UPNP network scan” menu in Settings but I canot find it. Can you please precise where it is?

Thanks again

Settings … Add-On Management

I am not sure, I am only using it for events.log.

Try this one, adapted from my regex filter for events.log:


<!-- Rolling file appender -->
            <RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i.gz" name="LOGFILE">

                     <!-- Regex Filter added below -->
					<Filters> 
                    <RegexFilter onMatch="DENY" onMismatch="ACCEPT" regex=".*upnpcontrol:upnprenderer:.*"/>
					</Filters>

                    <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
                    <Policies>
                            <OnStartupTriggeringPolicy/>
                            <SizeBasedTriggeringPolicy size="16 MB"/>
                    </Policies>
                    <DefaultRolloverStrategy max="7"/>
            </RollingFile>

Thanks again @sihui,

I tried both changes and unfortunately, after restarting openhab, I still have the UPnP discovery messages in openhab.log.

It is really strange that there is no easy way to get rid of these messages. I think I have now tried 25 ways and as many reboots without getting any result.

Thanks again for your help

I have (only) one more:

Did you try to set the logger to WARN or even ERROR?

Something like

<Logger level="ERROR" name="org.apache.cxf.phase.PhaseInterceptorChain"/>

(I can’t see the full name [g.discovery.internal.PersistentInbox], but you can …)

All of them??? I guess not. If really all of them, you need to verify the setting in “Setting” … “Inbox”: Ignore already existing Things

Yes,

Tried WARNING and ERROR as log level and still messages. I spent 2 weeks trying many different options before posting on the forum.

I also have all of things them created (I copied only a part of my thing file) and I ignored the things already. It might have to to with the BubbleUpnp software that does not identify things properly with the udn id.

Thank you. I will keep looking and post the solution if found so it helps others.

I had some time to test this and can confirm, regex filters also work for openhab.log.

Example:

2025-03-07 15:15:04.614 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Berlin'.

is gone after a reboot with the following filter in log4j2.xml:


<Filters>
	<RegexFilter onMatch="DENY" onMismatch="ACCEPT" regex=".*Time zone set.*"/>
</Filters>

The only thing I can think of you have a syntax error.
Did you note the little dot I added in the previous post to the filter? It is important to surround the filter with .* at the beginning and .* at the end. This way it reads the whole line.

Next issue could be the colon which maybe needs to be escaped. To avoid this I recommend to use this example: keep the indentation of your original file and make sure the filter is at the correct place between <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/> and <Policies>:

			<!-- Rolling file appender -->
            <RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i.gz" name="LOGFILE">
                   <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
				   <!-- Regex Filter added below -->
				   <Filters>
						<RegexFilter onMatch="DENY" onMismatch="ACCEPT" regex=".*upnpcontrol.*"/>
					</Filters>
                    <Policies>
                            <OnStartupTriggeringPolicy/>
                            <SizeBasedTriggeringPolicy size="16 MB"/>
                    </Policies>
                    <DefaultRolloverStrategy max="7"/>
            </RollingFile>

Thank you very much @sihui for your perseverance,

Indeed, this was a syntax error with the missing point (I put it the wrong way since I thought the line was an alias for the begining of the line so I had . instead of .).

My log file will now be much cleaner to fix minor other warnings I have here and there

Thanks again

1 Like