Frontail custom theme coloring

Hi,

Thought you know how to use docker as you mentioned you are also running OH in a docker container.
The approach of setting up the frontail container should be similar and can be done via command line.
But again, it’s important that your OH log folder is mounted externally so that frontail can usw it.
I so not use a Synology anymore, but there seem to be a lot of guides out there that show the basics.
Maybe start there and then it should hopefully make more sense on volume mounting and yaml.
Chris

Hi Chris, thanks for the link, it has made me a little smarter… I’ve only been using Docker since the day before yesterday and only via the Synology GUI, i.e. without a command line so far.

What I can’t imagine yet: The .yml file only consists of these few lines (with an adjusted volume):

frontail:
    image: schnuecks/frontail-multi:latest
    container_name: frontail
    command: --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab_AEM.json -t openhab_AEM -l 5000 -n 100 /logs/openhab.log /logs/events.log
    volumes:
    - /opt/openhab/userdata/logs:/logs:ro
    ports:
    - "9001:9001"
    restart: unless-stopped

And could you give me a tip for the spelling if two files are to be logged?

Below is my docker-compose.yml (make sure you call it this way):


frontail:
  image: schnuecks/frontail-multi:latest
  container_name: frontail
  command: --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab_AEM.json -t openhab_AEM -l 5000 -n 100 /logs/openhab.log /logs/events.log
  volumes:
  - /var/log/openhab/:/logs:ro
  ports:
  - "9001:9001"
  restart: unless-stopped

Based on my volume mount, I am basically mounting the full openhab log folder (in my case /var/log/openhab).

Take into account that you will need docker-compose though (which you need to install on top of docker). As mentioned, I never did run docker on Synology, but I would assume you can install docker-compose also via CLI (or even through packages?).

Once done and once you saved your docker-compose.yml you can then run sudo docker-compose up --force-recreate --build -d (this is my standard command, so that I do not have to change it every time I re-create a docker-compose, for you it could be shorter but makes no difference).

Let me know how it goes.

EDIT: If you want to log two different files, you will need to (1) mount the right directors and (2) edit the frontail command line to include those - i.e. /logs/yourlogname (as you can see from the volumes line, /logs:ro points at the moment to the openhab log folder; hence if you have different folders and want it all in one log window, you might need to adjust those paths accordingly)

Hi Chris, you are my man! It worked like magic (for the second time).

Thank you for your help and for your file.

Look really great!

And… I’ve learned something new…

For anyone else, here is my .yml file:

frontail:

  image: schnuecks/frontail-multi:latest

  container_name: frontail

  command: --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab_AEM.json -t openhab_AEM -l 5000 -n 100 /logs/openhab.log /logs/events.log

  volumes:

  - /volume1/docker/openhab/userdata/logs:/logs:ro

  ports:

  - "9001:9001"

  restart: unless-stopped
1 Like

Thank you for the additional themes and rules in the json.
I updated them to the main repository and credited you (hope it is ok).
:slight_smile:

Of course it is OK, Alberto. I am proud you used my code.

Hi Guys,

Bit late to the party but I’m in the process of moving my OH install to v3 and also from pi to Syno Docker. All going well and I’ve got a container from welteki working for logging via frontail.

I’ve just come across this thread as I was wondering if I could make the logs a bit more user / read friendly…and you guys have pretty much read my mind and done it for me…THANKS!

However, I’ve found the image schnuecks/frontail-multi:latest on docker, downloaded and launched it. Added the logs volume to the settings and run the container…

image

but it just runs for a second and then throws this error:

image

I’m relatively new to docker and have been trawling the thread and docker docs to work out what I’ve done wrong but I’m hoping one of the clever people on this thread can tell me where I’ve gone wrong / point me in the right direction.

TIA.

Hey!
@AEM I have a native debian 11 system. Could you tell me how do i install your frontail app please?

thanks!
best regards!

Sample for OH2 but it works for OH3 too, you need to change openhab2 to openhab in path.

@AEM great work !! Thanks !!
Can I ask for some additional feature?
Could you provide possiblity to choose which file should be presented: openhab.log, events.log, both, or add to a log line an info about filename to filter it?

Hello @orzechszek
Unfortunally I have no idea how to do what you are asking, I think it is something to do on the Frontail side. I just implemented the theme / colouring feature, that basically changes the layout of the HTML output, using css.
I don’t know how to modify what happens “before” the HTML is rendered.

Hello,

I’m too … I don’t get it installed on Ubuntu 22.04, even as I tried also openhabian-config. But it runs into an issue:

2023-03-10_18:33:42_CET [openHABian] Installing Frontail prerequsites (NodeJS)… FAILED

I guess even prerequisits are missed. Can someone guide me please as I also don’t get all the details in option 21, what’s doing this option 21. Seems really a hard job.

Thanks.

I would suggest to turn on DEBUG mode for openhabian-config. Then try to install frontail.
The output of the DEBUG mode should show more details about the error than just FAILED.
For more details about debug mode see openHABian | openHAB

Hello Wolfgang,
ok, that give the following details, which I don’t understand for now:

$ apt-get install --yes nodejs
+ apt-get install --yes nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-ares2 libnode72
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  nodejs
1 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/27.2 MB of archives.
After this operation, 127 MB of additional disk space will be used.
(Reading database ... 140451 files and directories currently installed.)
Preparing to unpack .../nodejs_16.19.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.19.1-deb-1nodesource1) over (12.22.9~dfsg-1ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.19.1-deb-1nodesource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_16.19.1-deb-1nodesource1_amd64.deb
Updating FireMotD available updates count ...
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
+ return 100
+ echo FAILED
FAILED

I’m on a Lenovo M910q, which means x86 64bit, not amd64.
Any suggestions?
Thanks!

Hi @EgonOlsen,

I’m not sure if you use openHABian, or your own linux server. In case you use your own distro the use of docker community edition might be an option to get it up and running without much problems.

I use a Ubuntu 22.04.2 LTS x86_64 server with docker-ce (don’t use docker desktop). If you install docker-ce the following configuration files should help you to setup things quickly:

On your system create the following two files in a directory (e.g. in $OPENHAB_CONF/docker/frontail).

Dockerfile
      FROM node:lts-alpine

      LABEL maintainer="Patrik Gfeller <patrik.gfeller@gmail.com>" \
            description="openHAB log viewer"
      
      RUN apk add git
      
      RUN git clone https://github.com/pgfeller/frontail_AEM.git /node
      
      WORKDIR /node
      
      RUN npm install -omit=dev
      
      EXPOSE 9001
      
      CMD /node/bin/frontail    \
          --disable-usage-stats \
          --ui-highlight        \
          --ui-highlight-preset /node/preset/openhab_AEM.json \
          --theme openhab_AEM   \
          -l 2000               \
          -n 200                \
          /log/events.log       \
          /log/openhab.log      \
          /log/automation.log   \
          /data/zigbee2mqtt/log/zigbee2mqtt.log
docker-compose.yml
version: '3.8'
services:
  frontail:
    container_name: openhab-frontail
    image: pgfeller/openhab-frontail
    restart: unless-stopped
    volumes:
      - $OPENHAB_USERDATA:/data
      - $OPENHAB_LOGDIR:/log
    ports:
      - 9001:9001
    environment:
      - TZ=Europe/Berlin

Ajust the configuration to your needs (which files do you want to track); then create the image and start the container (execute those commands inside the directory with the two files):

$ docker build -t pgfeller/openhab-frontail .
$ docker compose up -d

If all went well you should now have the openHAB Log Viewer exposed on port 9001 of your server (e.g. http://openhab:9001/):

Screenshots

with kind regards,
Patrik

2 Likes

Hi Patrick,

yes, I’m also on Ubuntu 22.04 LTS on a Lenovo M910q.

you made my day! Working like a charm :smiling_face_with_three_hearts:. I had some permission issues but that’s solved easily!
And with docker real perfect solution! Thanks!

with best regards,
Egon