Skip to content

FortiGate Security Reporting and Audit Automation

By Bikram Bhujel

Automation case study · August 2026

Turning FortiGate Daily Reports and Logs into Something People Can Read

A firewall produces one PDF security report a day and log files too large to open. I wrote Python and PowerShell tools that turn a month of daily reports into one report, and policy exports and traffic logs into audit workbooks.

LanguagesPython · PowerShell with embedded C#
InputsDaily FortiGate PDFs · policy exports · traffic and event logs
OutputsMonthly PDF report · Excel audit workbooks
EnvironmentCIMMYT office firewall
30 → 1Daily PDF reports combined into one monthly report
18 log partsOf 50–220 MB each, parsed into workbooks
Coverage statedMissing days are listed, not hidden
01 · The problem

Nobody reads thirty daily reports.

The firewall emails a PDF security report every day. Each one is readable, but nobody can see a month from thirty of them. Separately, a policy review needed the firewall rules, address translation rules and logs in a form that could actually be checked.

This post describes work I did in my role at CIMMYT. The network and equipment belong to CIMMYT; addresses, configurations, device names and the names of colleagues are left out on purpose. All figures come from my own project reports. The scripts are internal and not published.
02 · Part 1 · Monthly report

One report from a month of daily PDFs.

01
Parse every daily PDF.

Python extracts traffic, sessions, top applications, filtering events and system events from each report.

02
State the coverage first.

The report opens with how many days were available, for example 25 of 31, and lists the missing dates.

03
Summarise the month.

Traffic and session totals, peak days, and evidence that web filtering was enforcing policy.

04
List what deserves a look.

Events worth reviewing are pulled out of the data into a short list for the administrator.

05
Refuse to overclaim.

The report does not state 'no threats' when raw logs and the configuration were not part of its input.

03 · Part 2 · Audit workbooks

When the logs are too big for normal tools.

The traffic logs for one week came in 18 parts of 50–220 MB each. Spreadsheet tools and simple scripts could not handle them, so I wrote the parser in C# and ran it from PowerShell.

Inputs

PoliciesGUI export (CSV)
TrafficForward-traffic logs
EventsSystem event log

Outputs

Workbook 1Security policies
Workbook 2Address translation
Workbook 3Logs and summary
  • Hit count, bytes and first and last use for every rule, so unused rules stand out
  • A sources sheet in every workbook, so anyone can see what the numbers came from
  • A verification step that checks every sheet for formula errors and records key counts before anything is shared
04 · Design principles

Reports that can be trusted.

01
Say what the data covers.

A report that hides a missing week is worse than one that lists it.

02
Do not claim more than the input supports.

Summary PDFs cannot prove there were no threats, so the report does not say so.

03
Verify the output, not just the code.

The workbook check catches problems a reviewer would otherwise find first.

04
Build once, reuse.

The same daily-report parsing was later used for a field station's bandwidth analysis.

Comments

Questions and corrections are welcome. I read every comment before it appears, and remove spam and promotional links.