Disable log in some device

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Disable log in some device

Post by jackslayter »

Hi,
Its possible to add in roadmap an option for disable log in some device (virtual device or information device) ?

Thank you
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
User avatar
Thyraz
Posts: 7
Joined: Friday 28 August 2015 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Disable log in some device

Post 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. ;)
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Re: Disable log in some device

Post by jackslayter »

its possible to add this function , my memory card want it ;)
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Disable log in some device

Post by jannl »

You can set the log time to a very short period of time or is that not what you mean?
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Re: Disable log in some device

Post by jackslayter »

yes and no, I would like disable log in device you I choice
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
roblom
Posts: 408
Joined: Wednesday 26 February 2014 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: the Netherlands
Contact:

Re: Disable log in some device

Post 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.
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Re: Disable log in some device

Post by jackslayter »

its possible to remove log by command (in script) ?
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
olafmarcos
Posts: 17
Joined: Sunday 27 December 2015 1:09
Target OS: NAS (Synology & others)
Domoticz version: 9999
Location: Santander - Spain
Contact:

Re: Disable log in some device

Post by olafmarcos »

Up!

Any advance on disable logging?

Regards,

Olaf
Synology NAS ds215j, DSM 6.2
Domoticz Beta from Jadahl 9999
Z-wave (AEOTEC Aeotec Z-Stick Series GEN5,Fibaro FGRM222, FGS222, FGMS001-ZW5 Motion Sensor+)
Philips Hue Bridge
Nuki Lock Plugin
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Disable log in some device

Post 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
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Disable log in some device

Post 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!
olafmarcos
Posts: 17
Joined: Sunday 27 December 2015 1:09
Target OS: NAS (Synology & others)
Domoticz version: 9999
Location: Santander - Spain
Contact:

Re: Disable log in some device

Post 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,
Synology NAS ds215j, DSM 6.2
Domoticz Beta from Jadahl 9999
Z-wave (AEOTEC Aeotec Z-Stick Series GEN5,Fibaro FGRM222, FGS222, FGMS001-ZW5 Motion Sensor+)
Philips Hue Bridge
Nuki Lock Plugin
Delta78
Posts: 9
Joined: Sunday 30 December 2018 17:23
Target OS: -
Domoticz version:
Contact:

Re: Disable log in some device

Post 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.
DaaNMaGeDDoN
Posts: 55
Joined: Thursday 23 October 2014 19:01
Target OS: Linux
Domoticz version: beta
Location: Eindhoven, the Netherlands
Contact:

Re: Disable log in some device

Post 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).
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

Re: Disable log in some device

Post by devros »

yes also would love to see this feature, maybe in device list tab small icon for disable logs...
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

Re: Disable log in some device

Post 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 :shock:

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
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
User avatar
Louk
Posts: 17
Joined: Sunday 14 July 2019 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2 β
Location: Alkmaar, The Netherlands
Contact:

Re: Disable log in some device

Post 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?
Have fun,
Louk
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Disable log in some device

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
smukec
Posts: 3
Joined: Monday 11 November 2019 12:31
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Disable log in some device

Post by smukec »

Any news about that?
MisterP
Posts: 1
Joined: Wednesday 05 February 2020 16:53
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Disable log in some device

Post 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 ;)
User avatar
Louk
Posts: 17
Joined: Sunday 14 July 2019 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2 β
Location: Alkmaar, The Netherlands
Contact:

Re: Disable log in some device

Post by Louk »

Merci MisterP!

Not nice of me, but I forgot to reply my solution :oops:

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.
Have fun,
Louk
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest