[multitail] color scheme for openhab logs

I created a custom color scheme for the linux tool multitail to make the openhab logs more readable.

You can find all information here:

And here is a screenshot about how it looks.

Feel free to give any kind of feedback.

16 Likes

Great, maybe a thing that should be intergrated into openhabian. The daker blue is for me hardly to read.

Thomas

I already posted in the openhabian thread. :slight_smile:
Yes, blue is hard to read, but there are only so many colors and I think the prefixes of the Threads are not that importand.
But I just improved this by making the Threads in event.log cyan, too.

1 Like

Very cool!

Thanks for sharing!

Given that multitail can tail logs on a remote host (which is worth installing it for that alone) I wrote a quick Ansible Role that will install multitail and your color scheme so I can install it on several of my hosts.

Here it is for those who like Ansible.

I’m using the standard Ansible folder layout (i.e. roles/rolename/tasks/main.yml and role/rolename/vars/main.yml)

roles/multitail/vars/main.yml

---
multitail_url: https://vanheusden.com/multitail/multitail-6.4.2.tgz
multitail_file: /tmp/multitail.tgz
multitail_home: /opt/multitail
multitail_conf_file: /opt/local/etc/multitail.conf
openhab_color_url: https://github.com/CWempe/multitail-scheme-openhab.git
openhab_logs_dir: /opt/openhab2/userdata/logs/

roles/multitail/tasks/main.yml

---

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

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

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

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

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

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

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

- name: Clone the openHAB color scheme
  git:
    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
  lineinfile:
    path: "{{ multitail_conf_file }}"
    line: scheme:openhab:/var/log/openhab2/
    state: absent
  become: yes

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

NOTES:

  • It installed to /opt/local for me, not sure if that is standard. But it meant I had to add it to my path. I use fish so there is a task there to add it to my fish.conf. If you use another shell you will need to update that task.
  • I run openHAB in a Docker container and my logs end up in another location so I have some tasks to change it so the color coding works.

For the curious, to tail a log on a remote machine (assuming you have ssh key based logins set up)

multitail -l "ssh username@host tail -f file"
3 Likes

I’m probably being dense, but I followed the instructions from github, added the github raw text to the multitail conf file, and it’s still in black and white. Have I missed something?

Dan

I had problems, too, but then I placed the raw text right after “Oracle GoldenGate definition” and before PowerDNS definition (chosen randomly), I had the feeling, that the very last lines in /etc/multitail.conf are meant for other things…

debian 64-bit “stretch”

openhab@openhab2:~$ multitail -V
 --*- multitail 6.4.2 (C) 2003-2014 by folkert@vanheusden.com -*--

1 Like

well that was easy - thank you!

For anyone that hase problems reading the dark blue on black background with Putty:

In Putty Configuration set Window | Colours | Indicate bolded text by changing to Both.

See: https://stackoverflow.com/a/17429835/6411513

1 Like

Finally! This is now a default component of openHABian, starting today. Thanks @christoph_wempe!

On existing installations it can be installed by executing “Manual/Fresh Setup” -> “Bash&Vim Settings”.

Just stumbled upon this. Great work! Two thumbs up :slight_smile: