How to do reduce log interval

On various Hardware and OS systems: pi / windows / routers / nas, etc
ricard
Posts: 11
Joined: Sunday 24 January 2016 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

How to do reduce log interval

Post by ricard » Sunday 24 January 2016 18:11

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: 430
Joined: Tuesday 11 November 2014 19:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: How to do reduce log interval

Post by nayr » Sunday 24 January 2016 22:49

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Sunday 24 January 2016 23:12

Yes, I would like to have higher resolution on the graphs/data logged.

User avatar
Egregius
Posts: 2445
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius » Sunday 24 January 2016 23:13

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Sunday 24 January 2016 23:21

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: 2445
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius » Monday 25 January 2016 8:32

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Monday 25 January 2016 22:57

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: 2445
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius » Tuesday 26 January 2016 0:17

Sorry for giving my opinion in a discussion board.

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

Re: How to do reduce log interval

Post by ricard » Tuesday 26 January 2016 0:50

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: 430
Joined: Tuesday 11 November 2014 19:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: How to do reduce log interval

Post by nayr » Tuesday 26 January 2016 0:55

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Tuesday 26 January 2016 1:03

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Sunday 07 February 2016 13:25

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: 8526
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz » Sunday 07 February 2016 14:07

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 18:02
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by ricard » Sunday 07 February 2016 15:19

Hi gizmocuz

Thank you for the additional information.

User avatar
bizziebis
Posts: 530
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi
Domoticz version: 3.8337
Location: The Netherlands
Contact:

Re: How to do reduce log interval

Post by bizziebis » Sunday 07 February 2016 15:22

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: 2445
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius » Sunday 07 February 2016 15:27

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: 8526
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz » Sunday 07 February 2016 15:29

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: 2445
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: How to do reduce log interval

Post by Egregius » Sunday 07 February 2016 16:02

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: 70
Joined: Wednesday 02 March 2016 21:52
Target OS: -
Domoticz version:
Contact:

Re: How to do reduce log interval

Post by delchrys » Tuesday 08 March 2016 15:15

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: 8526
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: How to do reduce log interval

Post by gizmocuz » Tuesday 08 March 2016 18:17

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 3 guests