Skip to main content
AndiG
New Member
Apr 29, 2025 3:08 PM UTC
Solved

Generate a list of matching FortiGate policies

I like to generate a weekly report that includes any active FortiGate-Policy filtered by some keywords in their name.

I'm able to query them from $log-traffic, but obviously this gets only the policies with traffic.

Is there a table that includes the configured policies regardless of them having traffic or not?

funkylicious
SuperUser
Apr 30, 2025 6:01 AM UTC

as you already noticed, in FAZ you would have logs and info about the firewall policies that have either logging all sessions or security profiles matches.

 

you could do a diff between the policy id/name from FAZ that are being noticed there and the ones actually configured on the FGT.

in the GUI you would also enable the column Hit Count and see the ones with no match/0 hits or Last Used to see when they were last used/matched.

"jack of all trades, master of none"

3 replies

funkylicious
SuperUser
SuperUser
Apr 29, 2025 3:41 PM UTC

show firewall policy | grep TEXT ? you could do a -A X lines to print the next X lines

"jack of all trades, master of none"
AndiG
AndiGAuthor
New Member
Apr 30, 2025 4:42 AM UTC

Hi Funkylicious

Thanks for your suggestion. Grep would kind of work, yes...

But I'm looking for an automated solution, prefferably using FortiAnalyzer and being able to use its SQL capabilities for advanced filtering. 

funkylicious
SuperUser
SuperUser
Apr 30, 2025 6:01 AM UTC

as you already noticed, in FAZ you would have logs and info about the firewall policies that have either logging all sessions or security profiles matches.

 

you could do a diff between the policy id/name from FAZ that are being noticed there and the ones actually configured on the FGT.

in the GUI you would also enable the column Hit Count and see the ones with no match/0 hits or Last Used to see when they were last used/matched.

"jack of all trades, master of none"
Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT