Page 3 of 3

Re: Best practices for Domoticz logfile?

Posted: Saturday 25 April 2020 21:19
by jake
dressie wrote: Friday 24 April 2020 15:14 I got it to work!

I changed the following:
-moved the log file location from "/tmp" to "/var/log" (changed this in the /etc/init.d/domoticz.sh file)

Good luck, I hope this will work for you too!

P.S. this worked without the line in crontab -e.
Unfortunately no luck so far. I didn't have the delaycompress (I had it surpressed), so I added it again. Also the postrotate and endscript were surpressed, which should only be better, but in any case... I also found an empty extra line under the accolade, so I removed that as well. Let's see what happens.

BTW, you mention the file name as /etc/init.d/domoticz.sh for me it is both in another folder and doesn't have the .sh extension to it: /etc/logrotate.d/domoticz
The file you mention is to setup the logfile and it's location, it is not about rotation of the log

Re: Best practices for Domoticz logfile?

Posted: Sunday 26 April 2020 12:39
by jake
Well, although expected, I am a little bit disappointed today that the logrotate didn't run again last night. I still have the cron job as well, so there were 2 chances to run properly, but it didn't.

Re: Best practices for Domoticz logfile?

Posted: Sunday 26 April 2020 13:37
by dressie
jake wrote: Saturday 25 April 2020 21:19
Unfortunately no luck so far. I didn't have the delaycompress (I had it surpressed), so I added it again. Also the postrotate and endscript were surpressed, which should only be better, but in any case... I also found an empty extra line under the accolade, so I removed that as well. Let's see what happens.

BTW, you mention the file name as /etc/init.d/domoticz.sh for me it is both in another folder and doesn't have the .sh extension to it: /etc/logrotate.d/domoticz
The file you mention is to setup the logfile and it's location, it is not about rotation of the log
I ment that I changed the direction where Domoticz write it's log file in the domoticz.sh file. By default it writes to /tmp/~.
Sorry to hear it doesn't work for you, I had the same but after moving the log dir to /var/log and changing the domoticz logrotation file it started to work.

Re: Best practices for Domoticz logfile?

Posted: Sunday 26 April 2020 19:08
by jake
I copied the actual log file to /var/log as an experiment and updated the log definition. Let's see what happens tonight.

Re: Best practices for Domoticz logfile?

Posted: Monday 27 April 2020 10:20
by jake
jake wrote:I copied the actual log file to /var/log as an experiment and updated the log definition. Let's see what happens tonight.
Wouldn't you believe it? My copied log in /var/log rotated fine last night. Next step is to find out what is the difference. It must be access rights to the folder.

Re: Best practices for Domoticz logfile?

Posted: Monday 27 April 2020 12:33
by dressie
jake wrote: Monday 27 April 2020 10:20
jake wrote:I copied the actual log file to /var/log as an experiment and updated the log definition. Let's see what happens tonight.
Wouldn't you believe it? My copied log in /var/log rotated fine last night. Next step is to find out what is the difference. It must be access rights to the folder.
Nice! I think it has got to do with the location of the log file. It's common to have it in the "/var/log ". Perhaps logrotation is very particular about that.

Re: Best practices for Domoticz logfile?

Posted: Monday 27 April 2020 13:22
by jake
dressie wrote:
jake wrote: Monday 27 April 2020 10:20
jake wrote:I copied the actual log file to /var/log as an experiment and updated the log definition. Let's see what happens tonight.
Wouldn't you believe it? My copied log in /var/log rotated fine last night. Next step is to find out what is the difference. It must be access rights to the folder.
Nice! I think it has got to do with the location of the log file. It's common to have it in the "/var/log ". Perhaps logrotation is very particular about that.
Well, until Buster it has always worked and doing the command manually it also works, so somehow during the automatic execution it goes wrong.
The /tmp folder runs in a ram disk so moving the log permanently to/var/log is no option.

Re: Best practices for Domoticz logfile?

Posted: Wednesday 19 April 2023 16:27
by MikeyMan
Shouldn't this be standard functionality. My log file is currently a whopping 4,5 gb. This serves no purpose...

Re: Best practices for Domoticz logfile?

Posted: Monday 22 May 2023 8:55
by MikeyMan
Just had a couple of crashes, so i thought i'd have a look at the logfile.
Totally unusable, since it's amost 7GB again.

Is something wrong with my install? Is this default behavior?

Re: Best practices for Domoticz logfile?

Posted: Thursday 27 June 2024 20:17
by Patricen
Hello,

My domoticz.log file reached 18GB, good performance indeed! but the 64GB drive of my rpi is now full.
I would like to shrink it proceeding to a rotating log file over time week, month, year, tbd.
I don't need any ram drive as I'm using a SSD on a raspberry pi.
I'm a linux dummy, so I then request help.
Thanks

Re: Best practices for Domoticz logfile?

Posted: Thursday 27 June 2024 20:47
by Kedi
Use program logrotate.

Re: Best practices for Domoticz logfile?

Posted: Friday 28 June 2024 9:18
by Patricen
Thanks!
I mentioned that this file history is useless for me, is there a parameter to limit domoticz.log size?

Re: Best practices for Domoticz logfile?

Posted: Friday 28 June 2024 11:03
by waltervl
Patricen wrote: Friday 28 June 2024 9:18 Thanks!
I mentioned that this file history is useless for me, is there a parameter to limit domoticz.log size?
You can switch it off by commenting it out (#) from the /etc/init.d/domoticz.sh startup script (see wiki https://www.domoticz.com/wiki/Troublesh ... bugging.29 )
Then you only see the short log in the web interface menu Setup - Log.
This is also the default situation when installing a fresh install.

Re: Best practices for Domoticz logfile?

Posted: Friday 28 June 2024 13:36
by Kedi
Patricen wrote: Friday 28 June 2024 9:18 Thanks!
I mentioned that this file history is useless for me, is there a parameter to limit domoticz.log size?
No you did not, you asked for log rotation.
The history is the GUI is very short.
If you ever have errors, then the GUI will not help you to get those resolved, because the error remains in the GUI but the preceding logging is gone.

Re: Best practices for Domoticz logfile?

Posted: Friday 28 June 2024 19:32
by Patricen
Sorry, I did not mention, I realized.

I'll try to proceed to rotations, but limiting the log to 3MB would be sufficient, as it looks pretty complicated (for me) to run logrotate.

Re: Best practices for Domoticz logfile?

Posted: Friday 28 June 2024 21:54
by Kedi
If you install logrotate it will run, because it installs a service and timer.
In this topic are domoticz config files for domoticz logrotate present, just copy one of those and you are good.
Read this topic from the beginning.