Skip to main content
smorandell
New Member
Dec 16, 2024 12:19 PM UTC
Question

How to get all trafic logs by Rest-API?

Hi guys,
I am trying to get all forward traffic logs from the last 7 days via the Rest-API, filtered by specific policy IDs, but I only get the logs of a specific policy ID from the current second as a result (for example 2 logentries instead of over 1000). Does anyone have a solution to this problem?

I use the following path in the Webbrowser:
https://<ip fortigate>/api/v2/log/disk/traffic/forward/system?access_token=...&filter=policyid==...

I also tried to use a timestamp in the path, but it didnt solved my problem.


thanks

8 replies

smorandell
New Member
Dec 16, 2024 12:24 PM UTC

additional information of the api-request:

  "vdom":"root",   "device":"disk",   "category":"traffic",   "subcategory":"forward",   "start":1,   "rows":400,   "completed":2,   "percent_logs_processed":2,   "total_lines":4,   "now":1734351608533,   "ready":false,   "status":"success",   "version":"v7.2.9",

 

Translate
ebilcari
Staff
Staff
Dec 17, 2024 11:18 AM UTC

I did some tests with firmware 7.2.10 and by default it gets 400 rows. The value can also be increased, tested with 999 and got all the results in the output:
https://gw.eb.eu/api/v2/log/disk/traffic/forward/system?filter=policyid==19&rows=999

Translate
Emirjon
smorandell
New Member
Dec 17, 2024 12:14 PM UTC

Hi Emirjon,
I dont know why, but I dont get any logs.
The only result I get:

{   "http_method":"GET",   "results":[   ],   "vdom":"root",   "device":"disk",   "category":"traffic",   "subcategory":"forward",   "start":1,   "rows":999,   "session_id":5382,   "completed":2,   "percent_logs_processed":2,   "total_lines":0,   "now":1734437234123,   "ready":false,   "status":"success",   "version":"v7.2.9",   "build":1688 }

 Any Ideas?

Translate
Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024