Best practices for Domoticz logfile?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Best practices for Domoticz logfile?

Post 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
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
dressie
Posts: 156
Joined: Monday 25 May 2015 22:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Netherlands
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
dressie
Posts: 156
Joined: Monday 25 May 2015 22:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Netherlands
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Best practices for Domoticz logfile?

Post by MikeyMan »

Shouldn't this be standard functionality. My log file is currently a whopping 4,5 gb. This serves no purpose...
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Best practices for Domoticz logfile?

Post 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?
Patricen
Posts: 117
Joined: Tuesday 06 February 2018 18:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta rel
Contact:

Re: Best practices for Domoticz logfile?

Post 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
Kedi
Posts: 575
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Best practices for Domoticz logfile?

Post by Kedi »

Use program logrotate.
Logic will get you from A to B. Imagination will take you everywhere.
Patricen
Posts: 117
Joined: Tuesday 06 February 2018 18:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta rel
Contact:

Re: Best practices for Domoticz logfile?

Post by Patricen »

Thanks!
I mentioned that this file history is useless for me, is there a parameter to limit domoticz.log size?
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Kedi
Posts: 575
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
Logic will get you from A to B. Imagination will take you everywhere.
Patricen
Posts: 117
Joined: Tuesday 06 February 2018 18:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta rel
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
Kedi
Posts: 575
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Best practices for Domoticz logfile?

Post 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.
Logic will get you from A to B. Imagination will take you everywhere.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest