Wall-mounted dedicated tablet showing karaf log:tail - log won't update

  • Platform information:
    • Hardware: Raspberry Pi 3 B+, 120gb mSATA SSD in a USB enclosure
    • OS: Raspbian Stretch
    • Java Runtime Environment: 1.8.0_212
    • openHAB version: 2.4.0 release build. Jython 2.7.0

I’m trying to make a tablet show the karaf log:tail output at all times, so that I can mount it on my wall. It needs to reconnect an log in and start showing the log automatically, so that it doesn’t add a maintenance tax. (The whole point of home automation is to automate things, not add more manual steps).

I have a saved session in putty by the name of “openhab karaf” set up with the following settings:

  • SSH
  • IP, port 8101 (the local IP of my raspi running openhab)
  • Session: Close window on exit: ALWAYS
  • Terminal - Implicit CR in every LF: TRUE
  • Connection - Data - Auto-login username: openhab

I have a text file at c:\temp\openhab\commands.txt with the following contents:


And finally a batch file:

@echo off
start /wait /max "putty" putty.exe -load "openhab karaf" -pw mypassword -m c:\temp\openhab\commands.txt
ping -n 10
goto loop

When I start the batch file, putty successfully connects to karaf, and displays the last full page of logs… and then it just sits there.

It doesn’t display any more logs. The console is completely frozen and I have no idea why. I certainly did not expect this behavior, nor can I explain it. I expected that as new events happen, they would appear at the bottom of the list, as they do when I manually issue the log:tail command.

Now, I tried the same thing with normal SSH into raspbian (port 22) and the command tail -f /var/log/openhab2/openhab.log in commands.txt. Everything the same except different port, different command (and different login/pass). THAT WORKS PERFECTLY. As expected, the log appears and updates work fine! This tells me perhaps it’s some interaction with the karaf console?

It’s not really a workaround though as tail is not a good permanent log viewer, for one it lacks the color coding.

Does anyone have any idea what’s going on?
Or, can you suggest another way of turning an old (windows 10) tablet into a realtime openhab log viewer?

Why don’t you facilitate the logviewer from the openHAB dashboard?

Sure, why not. How do I do that? I’ve spent a few minutes searching the forum and couldn’t conclusively find what you’re referring to.

Search for Frontail which can be setup with the openhabian tool under Linux.

1 Like

I managed to get openhabian-config installed and working, and then installed the openHAB 2 Log Viewer. It works! Thank you for the suggestion.

Now there’s only one question left.

How do I make it scroll?
Because, it’s not. Things get added to the end but the view stays put. I need it to show the latest items unless I manually scroll back.

When accessed from firefox, it magically scrolls just fine. From chrome, it does not. Well then, I guess I will use firefox :).

But on-the-other-hand, it’s home automation, not IT automation.

Why do you need to get the logs from Karaf? Can’t you use Frontail on the openhab.log and events.log? Then you can put the browser into kiosk mode and there you have it.

I can’t say for sure but because you are kicking this off from a bat file there may be some issue with receiving updates.

Perhaps, but since they both have the same information why add the complexity of needing to log into the karaf console?

You should look into multitail.

Here is my Ansible playbook for installing multitail and Christoph’s color scheme.


- name: Install prerequisites
    name: "{{ item }}"
    update_cache: no
  become: yes
    - libncurses5
    - libncurses5-dev
    - libncursesw5
    - libncursesw5-dev

- name: Create multitail folder
    path: "{{ multitail_home }}"
    state: directory
    mode: a+rwx
  become: yes

- name: Clone multitail
    repo: https://github.com/flok99/multitail.git
    force: yes
    dest: "{{ multitail_home }}"

- name: Build and install multitail
    chdir: "{{ multitail_home }}"
    target: install
  become: yes

- name: Add multitail to the path
    path: /home/rich/.config/fish/config.fish
    line: set -gx PATH /opt/local/bin $PATH

- name: Copy the default multitail.conf
    src:  /opt/local/etc/multitail.conf.new
    dest: "{{ multitail_conf_file }}"
    remote_src: yes
  become: yes

- name: Add check_mail:0
    path: "{{ multitail_conf_file }}"
    line: "check_mail:0"
  become: yes

- name: Clone the openHAB color scheme
    repo: "{{ openhab_color_url }}"
    dest: /tmp/multitail-scheme-openhab

- name: Copy color scheme into multitail.conf
  shell: cat /tmp/multitail-scheme-openhab/multitail-scheme-openhab.conf >> {{ multitail_conf_file }}
  become: yes

- name: Remove line with path to openhab logs
    path: "{{ multitail_conf_file }}"
    line: scheme:openhab:/var/log/openhab2/
    state: absent
  become: yes

- name: Add path to openhab logs
    path: "{{ multitail_conf_file }}"
    line: scheme:openhab:{{ openhab_logs_dir }}
  become: yes

NOTE: I run in Docker so the log files are not in the default locations for me.

1 Like

Thank you, Rich! Surprise, surprise, there were much better methods in existence of solving the problem than what I first came up with. :slight_smile:

I have Frontail set up now and it works perfectly. Did not know about multitail either, will look at that too. The only question I have about Frontail is, is there a way to modify the frontail template, color scheme, header etc? Where is it defined that port 9001 should present frontail with the PaperUI look?

Well, Frontail is a third party application. You can find the github here. It appears to have some highlighting settings. It doesn’t appear to be as flexible as multitail but it’s there.

I don’t actually use Frontail nor openHABian so I don’t really know where the config files get placed. I’d look in /etc to start.

If you do go down the path of creating a color coding profile, I bet the openHABian folks would love to take a PR. Frontail might as well.

1 Like

Look at these files…

cp /opt/openhabian/includes/frontail-preset.json /usr/local/lib/node_modules/frontail/preset/openhab.json
cp /opt/openhabian/includes/frontail-theme.css /usr/local/lib/node_modules/frontail/web/assets/styles/openhab.css
cp /opt/openhabian/includes/frontail.service /etc/systemd/system/frontail.service

There is also another file which is the picture that Openhab uses on the dashboard which you can customise as well. There is a dark theme if you do not like a white Frontail look.

1 Like