API log export hard-coded to a 20 entry limit?

L2 Linker

API log export hard-coded to a 20 entry limit?

In panorama 5.1.5 code, I'm attempting to pull down traffic logs for analysis of application type vs rule.  My query is structured like this:

https://10.x.x.240/api/?type=log&log-type=traffic&query=%28%20receive_time%20geq%20%272012/12/31%200...

Which gives me a success return, along with "query job enqueued with jobid 181"

When I query the results using

https://10.x.x.240/api/?type=log&action=get&job-id=181&key=mykeyhere

I'm only getting 20 results - although there are many, many more entries in the logs.  Is this a hard-coded limit on results?  Is there a way around it?

L1 Bithead

Re: API log export hard-coded to a 20 entry limit?

20 is the default, but this is customizable up to 5000 using nlogs.  Use the following format:

https://<firewall>/api/?type=log&log-type=<type>&nlogs=<number of logs to return>&query=<URL encoded query parameters>&key=<API key>

You can use additional modifiers outlined in the API guide to start 5000 logs back and pull the previous 5000 logs.  You can continue doing this until all of the logs of interest are pulled.

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!