Hide logs by text


is it possible to hide certain runtime.busevent messages from the console? I am using an self-made wind-speed sensor that publishes data about every second on the console which looks like this

2016-06-28 23:18:20.134 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.11
2016-06-28 23:18:21.296 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.46
2016-06-28 23:18:22.515 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.2
2016-06-28 23:18:23.739 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.24
2016-06-28 23:18:25.106 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 1.98
2016-06-28 23:18:26.221 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.51
2016-06-28 23:18:27.411 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 2.46
2016-06-28 23:18:28.797 [INFO ] [runtime.busevents             ] - Weather_Windspeed_Dach state updated to 1.98 

As far as I understood the answer to this post it is only possible to disable logging for an entire binding, but as there are other devices using the mqtt binding in my case I don’t want to disable everything. Is it possible to just hide all messages starting with Weather_Windspeed_Dach state updated to?

I’m assuming OH 1.

It is not possible to just turn off logging statements that match a certain string. You can only control it for a full binding.

However, you can filter the log using standard command line rules. On Windows you need cygwin or some other similar type environment.

On Unix/Linux/OSX you would run the following from the command line:

tail -f <path to openhab.log> | grep -v "Weather_Windspeed_Dach state updated to"

Replace <path to openhab.log> with the actual path to your log file.

The tail -f will print any new contents to the supplied file to the screen.
The | takes that output and pipes it into the following command.
grep is a filtering command that is used to only print those files that match a given text. The -v inverts this behavior so only those lines that do not match the text get printed.

Using grep to filter is an option but it doesn’t prevent all the useless disk writes. In syslog it is possible to filter by text so I might have to send the openhab logs through syslog.

I don’t know if OH has the ability natively to send its logs to syslog. If it does or you figure out a way post how you did it back here others can benefit.