[SOLVED] Logview on ubuntu

You need to install frontail

npm i frontail -g

On Ubuntu you may need to install nodejs and npm

sudo apt-get install nodejs
sudo apt-get install npm

Then let’s create a service

cd /lib/systemd/system/
sudo nano frontail.service

And here’s the script:

#!/bin/sh -

[Unit]
Description=Frontail

[Service]
ExecStart=/usr/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=pi
Group=pi
Environment=PATH=/usr/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/bin/

[Install]
WantedBy=multi-user.target
Alias=frontail.service

Change the User and Group value to your ubuntu user running OH
Save

Then

sudo chmod 644 /lib/systemd/system/frontail.service
sudo systemctl daemon-reload
sudo systemctl enable frontail.service
sudo systemctl start frontail.service

After that you can edit the ‘preset.json’ in /usr/lib/node_modules/frontail/preset/ for frontail to highlight relevant OH information

Mine looks like this:

{
  "words": {
    "[ERROR]": "color: red;",
    "[WARN ]": "color: orange;",
    "[INFO ]": "color: green;",
    "Node is DEAD": "color: red;",
    "GroupItemStateChangedEvent": "color: #0026FF; font-weight: bold;",
    "ItemStateChangedEvent": "color: #ADD8E6;",
    "ItemCommandEvent]": "color: #00137F;",
    "hingStatusInfoChangedEvent": "color: #007F46;",
    "ON": "color: green; font-weight: bold;",
    "OFF": "color: red; font-weight: bold;",
    "received command": "color: yellow;"
  },
  "lines": {
    "/var/log/openhab2/openhab.log": "text-align: right; font-size: 1.5em; font-weight: bold; border-top: 2px solid #F8F8F8;",
    "/var/log/openhab2/events.log": "text-align: right; font-size: 1.5em; font-weight: bold; border-top: 2px solid #F8F8F8;",
    "ERROR": "background-color: #F3BFBF;",
    "model.script": "background-color: #A6CFFD; font-weight: bold;"
  }
}

Credit to @kubawolanin and @ThomDietrich
Taken from: https://github.com/openhab/openhabian/issues/28

Finally browse to http://OpenhabServerIP:9001

Good luck

4 Likes