[SOLVED] Openhab and event log file no longer working

  • Platform information:
    • openhabian on a RPi.

Everything was working correctly, logs etc and then I opened the event and openhab log files from a Win7 machine, deleted all text and saved. Idea being to clear the log and restart openhab to see what needed attention.
Now openhab works perfectly but no longer creates these two log files.
I’m not much of a linux user. It kind of looks like my windows machine buggered the permissions on the two log files.
Note the audit.log file still works.
Thanks Neil.

I would think/hope if you deleted the files altogether, OH would recreate them to it’s satisfaction.

Tip … backup your system before tinkering :wink:

Unfortunately it doesn’t recreate them after restarting the service or rebooting the Pi.

I have a backup of the general files but not a backup of the image.
I don’t understand the Amanda backup.
The audit.log still works though.

So still looking for help.

If you delete the files maybe openhabian-config tool can be used to recreate the logs.

Here’s a guide to make a backup of your image, compress it to a zip and restore the image. Works for Windows, Mac and linux

I did this the other day. I accidentally deleted the log when I was trying to just zero it.

I suspect when windows saved in your side it created a permissions issue.

I just created the log files and made them owned by openHAB and in group openHAB. This assumes standard install on your pi.

You may be able to recreate them then run fix permissions in openhabian config also.

I have not looked deeper and I am wondering why openHAB does not recreate them.

1 Like

I can make them manually by using nano but what are the commands to give ownership and group to openhab?

sudo chmod and sudo chown

If you need help with the commands type sudo chmod --help or sudo chown --help for examples.

I did chown openhab openhab.log

Chgrp the same.

Make sure to restart after.

@Thedannymullen For apt-get install, where did you delete and create the log file? I read where another user was missing the log viewer but everything else was good. Tried to use openhabian tools to fix, but no go, had an error that looked as if the SD card was corrupt.


The logs are under /var/log/openHAB

Hi All,
Yup, I broke the user and group permissions.

openhabian@openHAB:~$ ls -l /var/log/openhab2/
total 10800
-rw-rw-r-- 1 openhab openhab 1058 Oct 21 19:49 audit.log
-rw-rw-r-- 1 openhabian openhabian 8556915 Sep 9 20:15 events.log
-rw-rw-r-- 1 openhabian openhabian 2491211 Sep 9 20:15 openhab.log
-rwxrwxr-x 1 openhab openhabian 0 May 28 18:33 Readme.txt

Basically, the events.log and openhab.log should have the same user:group as the audit.log ie openhab:openhab.

For those that do the same, here is how to fix it:
openhabian@openHAB:~$ sudo /etc/init.d/openhab2 stop
openhabian@openHAB:~$ sudo chown openhab:openhab /var/log/openhab2/events.log
openhabian@openHAB:~$ sudo chown openhab:openhab /var/log/openhab2/openhab.log
openhabian@openHAB:~$ sudo /etc/init.d/openhab2 start

And away we go again.
Thanks for your help gentleman.

Now to do something about that backup.

Kind regards,