[SOLVED] Grepping karaf's log:tail

Tags: #<Tag:0x00007efedb1ddd88> #<Tag:0x00007efedb1ddba8>

I use the karaf console with the command log:tail to view the live-logs of my openHABian system. Unfortunately, there is very much noise in my logs – for example, I use the sysinfo binding so I receive one ItemStateChangedEvent per second about my pi’s CPU temp, which can be really annoying when I am trying to debug a rule.

How can I filter this log? I tried the following variants without success:

  • log:tail light (to only show lines matching “light” – no output)
  • log:tail | grep light (output remains unfiltered).

How can I achieve this aim? I also considered using tail from a regular SSH shell, without karaf. But it does not union the logs of multiple files, and multitail -iw does not look really convenient to me.

Can you give me any hint? :slight_smile:

Are you sure not all displayed lines have that string in them?
I have successfully used grep inside Karaf.

You do know the the timeframe in which those informations are reported is fully adjustable?
Why don’t you monitor those logs via the openhab logviewer (from the dashboard)? Filtering is quite easy there.
YourSystemIP:9001

1 Like

You do know the the timeframe in which those informations are reported is fully adjustable?

The CPU temp events appear every seconds. In my most experiments, they appear between the relevant lines.

Why don’t you monitor those logs via the openhab logviewer (from the dashboard)? Filtering is quite easy there.

Ah, thank you! I’m actually trying to use the console for more things, but this logviewer works quite well. I was not aware of this possibility.
(The only drawback I found in the web interface so far is that it does not support automatical scroll-to-bottom.)

I have configured my systeminfo to report the High Priority Tasks every 60 seconds, the temperature is one of them. Reporting more often does keep the temperature higher, if you want to heat something up!

1 Like

If you have a lot of temp reading that you don’t care to see in the log you can filter those out.

Also, when you edit the file you only need the first part of the item name e.g. Esp_Temp, Esp_Hum, Esp_Press only requires Esp in the log to filter them all. :wink:

1 Like