[SOLVED] Display log files in UI

try this (change your folder structure and ip)

Script (shows the last 1000 events sorted by last event in first position)
script openhablogs.sh:

tac /opt/oh18/logs/events.log | head -n 1000 > /opt/oh18/webapps/weblogs/events.log
tac /opt/oh18/logs/openhab.log | head -n 1000 > /opt/oh18/webapps/weblogs/openhab.log
date +"%d.%m.%Y %T"


String st_copyLogs {exec="<[/opt/oh18/configurations/scripts/openhablogs.sh:60000:REGEX((.*?))]"}


Text label=“LogFiles” {
Text item=st_copyLogs label=“openhab.log [%s]” icon=“settings” {
Webview url=“xxxxx:8080/weblogs/openhab.log” height=20
Text item=st_copyLogs label=“events.log [%s]” icon=“settings” {
Webview url=“xxxxx:8080/weblogs/events.log” height=20

1 Like

Thank You


I tried your solution @Tab_Daham
Bash script works fine. But how do you call the bash script? Is it triggered from openhab or by cron job or whatever?

from wiki: refresh in millisec.
> in: exec="<[<commandLine to execute>:<refreshintervalinmilliseconds>:(<transformationrule>)]"
should update every minute

Yeah, ok.
I was kind of blind.
And my problem was a permission issue.
Now everythinks works fine.

Does anyone has an idea how to adapt this to oh2/openhabian?

Where to find the logs?
Where to store the new log string?
Where to store script?

1 Like

Another nice tool to display log files in openhab is frontail, just search for it in Examples of HABPanel Solutions - There is a screenshot as well as very basic “installation” instructions in that thread.

Nice work.

In openhab 2.x, the directions are different.

should it be ?

tac /var/log/openhab2/events.log | head -n 1000 > /etc/openhab2/html/events.log

I made the adaptations to OH2 but unsuccessful in sitemap view.

I would strongly suggest using frontail:

Purpose was to display the logs in a sitemap.
I am regularly using the frontail locally with the browser.

If you can give a little more info than “unsuccessful” it may help.

Exec binding v2 usage is very different to the v1 used in original post.

You can use a webview in the sitemap pointing to frontail.

Could you please give me a hint how to do that?

I have access to http://openhabianpi:9001/
and I can see on the top of the window:

tail -f /var/log/openhab2/openhab.log /var/log/openhab2/events.log

Sitemap webview

Hello, I did you solution but it didn`t working when I am connected to my openHAB.org, cloud solution? Do you know how to solve it?

Look here for OH2: oh2 showing logs in webview