We're working in a way to bring more value to data gathered through PRTG. To accomplish this, we're indexing the data from PRTG into a third party application. The problem is: We get data trough API. The data gathering for the History of the sensors and devices was pretty simple, since it wasn't too much, but now we're working with the logs, and there is a HUGE amount of data. Here we have 2 questions: 1. Whats the max amount of entries we can retrieve from API of the logs from devices/sensors in PRTG? 2. Does PRTG run a schedule to clear the logs from the devices? We noticed that the results from the web GUI and the results from the API are a bit different too. Here's the api URL we're using:
You can retrieve an unlimited amount of logs at once by specifying count=*
PRTG reports in its response that up to 1,000,000 logs are available, regardless of the true number
By default I believe PRTG only stores 30 days worth of logs. You can configure this under Setup -> Historic Data Purging -> Logfile Records
Rather than attempting to retrieve all logs at once however (which will kill PRTG), it is recommended to use a "streaming" approach by alternating the "count" and "start" properties respectively. Logs start at index 1, so your first request should specify start=1, second request count=500&start=501, etc. To figure out how many logs are available you need to compare the number of logs you asked for with the number of results you got to ascertain whether there are still any more logs available
Streaming logs from PRTG can be a fairly complicated process. Depending on what you're going to do with this data, you may find it easier to simply use PrtgAPI using PowerShell, which handles all of this paging logic for you
The max value for count is 50000, no matter what you manually beyond that.
@lordmilko: Thanks for your input, as always :)
@lordmiko thank you! I think the best is to do some sort of streaming approach as you suggested, I'll try It. And thanks for the log purging config, didn't knew about that.
@erhard I'm not sure if this value is correct, since I used a script I made to get the logs from root (id 0) and it brought me 1.094.430 results. The value I've put in count to this number was 999.999.999. The datetime of the last result here was 29/05 (as of api call was made 29/05), so I think the data purging is configured to 2 months (didn't checked yet), and the 1 million results was then capped on the real amount of data, not for the quantity of data.
I'll keep up with the tests, and will update this thread with all the information I gather.
Thank you both for the help.
Hm, ok, it seems now you got me :D
It appears it can be overridden when passing manually a greater value than that, though documentation in https://your.prtg.server/api.htm?tabid=3 states that max value for "count" parameter is 50000, interesting.