Skip to main content
smorandell
New Member
December 16, 2024
Question

How to get all trafic logs by Rest-API?

  • December 16, 2024
  • 8 replies
  • 4412 views

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
December 16, 2024

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",

 

ebilcari
Staff
Staff
December 17, 2024

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

Emirjon
smorandell
New Member
December 17, 2024

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?

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!