This article describes how to get FortiAnalyzer Top Applications/Top Sources data using JSON API.
FortiAnalyzer.
Steps:
JSON request body:
{
"method": "add",
"jsonrpc": "2.0",
"id": 112,
"params": [{
"url": "/fortiview/adom/{{adom}}/top-applications/run",
"limit": 10,
"apiver": 3,
"device": [{
"devname": "All_FortiGate"
}],
"count-total": true,
"time-range": {
"start": "2024-12-02 15:00:00",
"end": "2024-12-24 16:00:00"
}
}],
"session": "{{session}}"
}
JSON request body:
{
"method": "get",
"jsonrpc": "2.0",
"id": 112,
"params": [{
"url": "/fortiview/adom/{{adom}}/top-applications/run/{{taskid}}",
"apiver": 3,
"count-total": false
}],
"session": "{{session}}"
}
Troubleshooting steps:
The following debug command can be run from FortiAnalyzer to verify the API request and results:
diag debug application fazsvcd 255
diag debug enable
Sample debug output for step 1:
<...truncated...>
[T31409:process_jsonrpc.c:1748] request:
{
"id": "3993",
"jsonrpc": "2.0",
"method": "add",
"params": [ { "url": "\/fortiview\/adom\/root\/top-applications\/run", "limit": 2, "apiver": 3, "device": [ { "devname": "All_FortiGate" } ], "count-total": true, "time-range": { "start": "2024-12-02 15:00:00", "end": "2024-12-24 16:00:00" } } ]
}
[T31409:process_jsonrpc.c:1574] uri=/fortiview/top-applications/run, adom=root, uri_sub=top-applications/run
<...truncated...>
[T11209:fv_hdlr_sql_query.c:3102] [top-applications] got final result [ret=0 resolve_hostname=0]
[T11209:fv_hdlr_sql_query.c:3110] fv_sql_query():3110 process_query_result took 0.0017 sec
[T11209:fazsvc_hdlr_fortiview.c:1831] forti_view_run_exec():1831 Run Query took 5.2986 sec
[T11209:fazsvc_hdlr_fortiview.c:1846] Function returns: tid: 655949941 retc: 0
[T31377:fazsvc_session.c:2124] Client ('11') is accepted.
[T31410:fazsvc_session.c:1929] Handle request from client ('11'), wait=0 sec.
Sample debug output for step 2:
<...truncated...>
[T31410:process_jsonrpc.c:1748] request:
{
"id": "3994",
"jsonrpc": "2.0",
"method": "get",
"params": [ { "url": "\/fortiview\/adom\/root\/top-applications\/run\/655949941", "apiver": 3, "count-total": false } ]
}
[T31410:process_jsonrpc.c:1574] uri=/fortiview/top-applications/run/655949941, adom=root, uri_sub=top-applications/run/655949941
<...truncated...>
[T31410:fazsvc_session.c:1970] jsonapi response={ "jsonrpc": "2.0", "id": 3994, "result": { "data-time-range": { "start": 0, "end": 0 }, "db_start_time": 1734825600, "percentage": 100, "max-value": { "num_users": 2.000000, "bandwidth": 34768.000000, "sessions": 164.000000 }, "total-count-all": 1885, <...truncated...> } ], "return-lines": 2 } }.
[T31410:fazsvc_session.c:1975] Prepare to sent the result to client 11. (ds_size=1011)
[T31410:fazsvc_session.c:1975] Client ('11') disconnected (rv=-1).
Related articlea:
Technical Tip: The task limit for asynchronous log searches in FortiAnalyzer
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.