Appendix C: SQL Log Databases : Querying FortiAnalyzer SQL log databases : Examples : Example 4: Top WAN optimization applications
 
Example 4: Top WAN optimization applications
Web-based Manager procedure:
1. Go to Report > Advanced > Dataset.
2. Click Create New to create a new dataset and enter a dataset name (such as "WAN_OPT").
3. Under Log Type($log), select Traffic.
4. Enter the query:
SELECT wanopt_app_type, SUM( wan_in + wan_out ) AS bandwidth
FROM $log
AND subtype = 'wanopt-traffic'
GROUP BY wanopt_app_type
ORDER BY SUM( wan_in + wan_out ) DESC
LIMIT 5
CLI procedure:
To perform the same task using the CLI, use these commands:
config sql-report dataset
edit WAN_OPT
set device-type FortiGate
set log-type traffic
set query "SELECT wanopt_app_type, SUM( wan_in + wan_out ) AS bandwidth FROM $log AND subtype = 'wanopt-traffic' GROUP BY wanopt_app_type ORDER BY SUM( wan_in + wan_out ) DESC LIMIT 5"
end
Notes:
The WAN optimizer module will log each application bandwidth. All bandwidth data is logged in traffic logs and wan opt data will have the subtype ‘wanopt-traffic’
SUM(wan_in + wan_out) AS bandwidth - this calculates the total in and out traffic.