When troubleshooting or verifying lots of IPv4 policies, it cannot be directly extracted on FortiGate to a CSV file.
Only FortiManager can extract IPv4 policies to the CSV files.
This article describes how to extract IPv4 Policies on the FortiGate and convert them to CSV files with good visibility.
Note that Fortinet Technical Support does not provide any troubleshooting assistance for extracting IPv4 Policies from your FortiGate config file to a CSV file.
It is possible to use the below method for the below 6.4 versions.
1). Use this script fgpoliciestocsv.py.
Download it via the link below:
2). Export the configuration of the FortiGate, by the backup or command line (FortiGate configuration file: 'Fortinet_2019121….conf').
3). In the configuration file, search the 'config firewall policy', then copy and paste IPv4 policies to cfg file (cfg file: 'fgfw.cfg').
If you want to download all the policy details including the byte counts from the firewall GUI on the 7.0.2 and above version follow the below steps.
To export the firewall policy list to a CSV or JSON file: