Page 1 of 1
Disable log in some device
Posted: Thursday 09 October 2014 10:37
by jackslayter
Hi,
Its possible to add in roadmap an option for disable log in some device (virtual device or information device) ?
Thank you
Re: Disable log in some device
Posted: Tuesday 01 September 2015 14:56
by Thyraz
Would love to see that too.
I like to keep temperature data as long as possible but other devices like motion sensors in every room are more sensible.
It just feels wrong if you try to avoid services that track you in the internet and then implementing your own tracking system at home.

Re: Disable log in some device
Posted: Tuesday 24 November 2015 15:12
by jackslayter
its possible to add this function , my memory card want it

Re: Disable log in some device
Posted: Tuesday 24 November 2015 15:17
by jannl
You can set the log time to a very short period of time or is that not what you mean?
Re: Disable log in some device
Posted: Tuesday 24 November 2015 15:18
by jackslayter
yes and no, I would like disable log in device you I choice
Re: Disable log in some device
Posted: Thursday 26 November 2015 22:03
by roblom
jackslayter wrote:its possible to add this function , my memory card want it

mine too, there is a pulse counter with more than 2.400.000 log records where now the database is more than 120MB so also a lot of DB backups of more than 120MB so no space left on my SD. I try to remove the records but that takes about a day for 50.000 records... so yes i like this disable log functionality.
Re: Disable log in some device
Posted: Wednesday 02 December 2015 15:17
by jackslayter
its possible to remove log by command (in script) ?
Re: Disable log in some device
Posted: Monday 05 December 2016 22:01
by olafmarcos
Up!
Any advance on disable logging?
Regards,
Olaf
Re: Disable log in some device
Posted: Monday 05 December 2016 22:37
by Flopp
I also would like to disable log for e.g. Pulse counter and other devices that sends data every minute or more often.
+1
Re: Disable log in some device
Posted: Monday 05 December 2016 22:43
by Egregius
You could opt to remove entries of devices you don't want.
I remove every night quite a lot. All unused device entries, all entries older than 1 day and for some tables everything.
Code: Select all
<?php
$db = new SQLite3('/volume1/@appstore/domoticz/var/domoticz.db');
$clean = strftime("%G-%m-%d %k:%M:%S",time()-86400);
$tables = array( 'MultiMeter',
'MultiMeter_Calendar',
'Percentage',
'Percentage_Calendar',
'Rain',
'Rain_Calendar',
'Temperature',
'UV',
'UV_Calendar',
'Wind',
'Wind_Calendar');
foreach($tables as $table)
{
$query=$db->exec("DELETE FROM $table WHERE DeviceRowID not in (select ID from DeviceStatus where Used = 1)");
if ($query)
{
$rows = $db->changes();
if($rows>0)
echo $rows." rows removed from $table<br/>";
}
$query=$db->exec("DELETE FROM $table WHERE Date < '$clean'");
if ($query)
{
$rows=$db->changes();
if($rows>0)
echo $rows." rows removed from $table<br/>";
}
}
$tables = array('Temperature_Calendar','Meter','Meter_Calendar','LightingLog');
foreach($tables as $table)
{
$query=$db->exec("DELETE FROM $table");
if ($query)
{
$rows=$db->changes();
if($rows>0)
echo $rows." rows removed from $table<br/>";
}
}
$sql = 'VACUUM;';
if(!$result = $db->exec($sql))
{
die('There was an error running the query [' . $db->error . ']');
}
Cleaning of specific devices:
Code: Select all
$query=$db->exec("DELETE FROM $table WHERE DeviceRowID in (10,20,30)");
if ($query)
{
$rows = $db->changes();
if($rows>0)
echo $rows." rows removed from $table<br/>";
}
You're database will be lots smaller, faster, easier to handle, safer,...
Of course: use at your own risk, above removes a lot!
Re: Disable log in some device
Posted: Thursday 07 June 2018 23:58
by olafmarcos
Umm, i think the question it isn't how to remove logs but disable them...
In my case, it is due a Hue lights system that is sync with the TV. Every change in tv light makes a log in the lights devices that are wasting my NAS disks.
Hoping this funcionality come to us in near future to extend the live of expensive disks/sd memories.
Regards,
Re: Disable log in some device
Posted: Tuesday 15 January 2019 18:51
by Delta78
No news for this feature ?
It's too boring for me, I have a custom sensor, it change 2 time in a day but domoticz write an information every 5mn in the database, for nothing.
Re: Disable log in some device
Posted: Wednesday 03 July 2019 15:15
by DaaNMaGeDDoN
Got the same issue, still searching for a fix, pulse meter (now with smart P1) is filling the logs. I dont have the issue of running on flash memory (wear), i log to systemd running Domoticz natively on a linux machine, but my logs are flushed/rotated way too soon because they keep filling up with entries "(P1 Smart Meter) P1 Smart Meter (Electric Power Consumption)". Could not find a way to tune down the polling frequency so i need to exclude them from the logs or something. If anybody found a fix pls share, i'll do too if i find something (in the coming time).
Re: Disable log in some device
Posted: Wednesday 03 July 2019 21:52
by devros
yes also would love to see this feature, maybe in device list tab small icon for disable logs...
Re: Disable log in some device
Posted: Tuesday 16 July 2019 9:24
by Solderbro
To make Domoticz more solid state memory friendly, the database file should be replaced by single files.
I have 4events/second here and today TLC (triple level cell) only provide 1000 write cycles. The static database file keep all events in the same cells on the disk, what results to the heavy wear out. Read about Raspi solutions for smart home that kill SD cards every 3 months
Logs to separate files with configurable path would help a much. Logrotate from the host operating system can be used to deal with them.
Solderbro
Re: Disable log in some device
Posted: Wednesday 17 July 2019 2:17
by Louk
I'm not sure about the database (yet), but logging is a big issue to me too: An option to disable or reduce the logging would be very nice!
After some investigation, I found a configuration file (/var/packages/domoticz/target/var/scripts/domoticz.conf) that contains options to do this, but changing the file does not seem to make any difference.
Does anyone knows how to make Domoticz use the options in this file?
Re: Disable log in some device
Posted: Wednesday 17 July 2019 6:41
by waaren
Louk wrote: ↑Wednesday 17 July 2019 2:17
I'm not sure about the database (yet), but logging is a big issue to me too: An option to disable or reduce the logging would be very nice!
Assuming you use the package from @jadahl, the logfile and level is set in /var/packages/domoticz/scripts/start-stop-status
You can change the settings in this file but please be aware that this file is overwritten after every update of the package.
Re: Disable log in some device
Posted: Wednesday 20 November 2019 10:18
by smukec
Any news about that?
Re: Disable log in some device
Posted: Wednesday 05 February 2020 17:06
by MisterP
Hello,
To handle the levels of log in domoticz you have to:
- stop domoticz service (
sudo /etc/init.d/domoticz.sh stop)
- edit domoticz.sh (
sudo nano /etc/int.d/domoticz.sh)
- edit or add this line:
DAEMON_ARGS="$DAEMON_ARGS -log /tmp/log/domoticz.log -loglevel normal" (part in red must be modified to fit your current log location

)
loglevel can be a combination of : "normal,status,error,debug" separated by comas but without spaces, or omitted
- restart domoticz service (
sudo /etc/init.d/domoticz.sh start)
But it only partially fixes your issue. You cannot prevent some devices from logging. (I would like to do so, as some of my event scripts are logging a lot)
I see some of you talking about sd card wear, don't forget to move your logs in a ram disk to avoid ruining your sd card. I just did it some days ago after my previous card died after 20 months (365 days 24/7 of working, like all domoticz raspberries)
Same for database files.
Hope it will help you reducing your logs. ( keeping only status and error as loglevel is a good start)
Be careful while modifying your domoticz configuration, as you may break the whole thing. A good advice could be to always make a backup before modifying a conf file.
PS: excuse my bad english I am French

Re: Disable log in some device
Posted: Friday 07 February 2020 21:45
by Louk
Merci MisterP!
Not nice of me, but I forgot to reply my solution
In the same file, I've added
-verbose 0 -loglevel 2 right after
-log ${LOGFILE} in the start/stop script
/var/packages/domoticz/scripts/start-stop-status. I'm not sure what loglevel 2 means, but it gives me enough data to see what's going on in most situations.
Note the difference in the path name: This is because I don't run on a Pi, but a Synology DS418.