How to do reduce log interval

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How to do reduce log interval

Post by ricard »

Hi,

I would like to reduce the log interval from 5 minutes to 1 minute.

Which file of the source code do I need to modify and re-build?

Thank you
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: How to do reduce log interval

Post by nayr »

what?

There is no log interval.. if you dont have activity there is nothing to log.. or are you wanting higher resolution on the graphs?
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

Yes, I would like to have higher resolution on the graphs/data logged.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius »

I think it would be better to have a setting per switch.
I would definitely don't wanna have records of all temps and setpoints every minute. That would be over a million records a month.
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

My intention is to modify the code so that the interval is 1 minute instead of 5 minutes, and only log/record the value if the deviation is more than 10%.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius »

I guess the graphs can't handle gaps in the timings. What else could be the reason for storing the same value every 5 minutes?
I only keep temperature data of the last 12 hours and that's 3400 records.
I like to keep the database as small as possible, seems to be much faster and stable that way. Every night I remove records of temperature, meter, percentage devices I don't care about.
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

Dear Egregius,
"The man who says it can't be done... shouldn't interrupt the man who is trying to do it"

I would like to reduce the log interval from 5 minutes to 1 minute.
I am happy to work with the source code, and I would appreciate if somebody can tell me which are the file/s that I will need to modify.
Thank you
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius »

Sorry for giving my opinion in a discussion board.
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

I couldn't find an appropriate subforum, so I wrote my question in here.

I am trying to make a Historian and I would appreciate any constructive ideas/opinions.
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: How to do reduce log interval

Post by nayr »

the only way to learn the code base is to start digging into it, it would take longer to try to explain it than it would be to just implement it.. Ive been hacking at it for a while and still dont have a solid grasp of where everything is done at.. its alot of lines to look through.

the code is all yours, let us know what you come up with.. sorry I cant help you, Ive been avoiding mucking with the datasets directly until I better understand the consequences of my actions.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

I think it I can change it in the SQLHelper.cpp file.

But as you said, there is a lot of code to dig.

It would be great if someone could point to the right place.
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

Just in case someone is interested (which I think there will be more than one)

I have successfully changed the log interval from 5 minutes to 1 minute by changing the iShortLogInterval in the SQLServer.cpp

And then rebuilding/re-making the code
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz »

you have to remove 2 lines in the SQLServer.cpp and then you can change it in the database (actually the html code is also there but hidden)

Code: Select all

	if (!GetPreferencesVar("ShortLogInterval", nValue))
	{
		nValue = 5;
		UpdatePreferencesVar("ShortLogInterval", nValue);
	}
then underneed remove these two lines

Code: Select all

	if (nValue < 1)
		nValue = 5;
i probably must have some good reason not to expose this yet ?
Quality outlives Quantity!
ricard
Posts: 11
Joined: Sunday 24 January 2016 17:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard »

Hi gizmocuz

Thank you for the additional information.
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: How to do reduce log interval

Post by bizziebis »

I think with the right explanation next to the option a person should have the possibility to change the value from settings. Or are there any caveats when changing to a smaller interval?
I can imagine a fast growing database and a less responsive interface due to large json requests.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius »

Everyone has a specific reason for settings like this. I would't lower it, instead rise to 10 or 15 :p
Speed is more important than a graph for me.
But, as said before: the best option would be to set it for every sensor seperately.
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz »

there has been another approach offered on this forum, if value is different then the last value in the log, add the value
could be worth investigating by someone
Quality outlives Quantity!
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius »

That would even be a better solution :)
If it doesn't break the graphs that is.
In my situation I have a record every 5 minute in each room for a thermometer, a setpoint and a radiator valve. Especially for the setpoints it's very repitive data in the tables.
delchrys
Posts: 51
Joined: Wednesday 02 March 2016 20:52
Target OS: -
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by delchrys »

gizmocuz wrote:you have to remove 2 lines in the SQLServer.cpp and then you can change it in the database (actually the html code is also there but hidden)

Code: Select all

	if (!GetPreferencesVar("ShortLogInterval", nValue))
	{
		nValue = 5;
		UpdatePreferencesVar("ShortLogInterval", nValue);
	}
then underneed remove these two lines

Code: Select all

	if (nValue < 1)
		nValue = 5;
i probably must have some good reason not to expose this yet ?
Which file do we need to edit to change logging to 1 minute, is it SQLHelper.cpp or SQLServer.cpp??
I tried it in SQLHelper.cpp and rebuild it with
gcc -c SQLHelper.cpp
And then again the:
make -j 4
But when i reboot the pi and/or reboot domoticz, i still have 5 min intervals.
Am i doing something wrong???
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz »

Did you also made a change in the database as mentioned ?
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests