What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How many logs can I get with the table.json api?

Votes:

0

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:

https://<host>/api/table.json?content=messages&output=json&columns=objid,datetime,parent,type,name,status,message&count=99999&start=2010-01-01-00-00-00&id=0&noraw=1&usecaption=true

api history http-api json log web-request

Created on Jul 29, 2019 9:16:40 PM



4 Replies

Accepted Answer

Votes:

2

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

C:\> Get-ObjectLog

Regards,

lordmilko

Created on Jul 30, 2019 6:17:39 AM



Votes:

1

Hello Jesus,

The max value for count is 50000, no matter what you manually beyond that.

@lordmilko: Thanks for your input, as always :)

Kind regards,

Erhard

Created on Jul 30, 2019 7:06:19 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

@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.

Created on Jul 30, 2019 12:40:51 PM



Votes:

0

Hi Jesus,

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.

Kind regards,

Erhard

Created on Jul 30, 2019 1:05:58 PM by  Erhard Mikulik [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.