Technical Tip: Using a CLI command to check the firewall policy creation date and time
Description
Â
This article describes how to check the firewall policy creation date and time using a CLI command.
Â
Scope
Â
FortiGate.
Â
Solution
Â
SSH into the FortiGate and run the following commands to filter the event logs and display the firewall policy creation event:
Â
execute log filter device 0
execute log filter category 1
execute log filter field msg "Add firewall.policy <id>"
execute log displayÂ
Note: the third command filters the message ('msg') field for the specified string, and the '<id>' value should be changed to the appropriate Firewall Policy ID (or omitted entirely). For example, the following is the result of using the above filters with 'Add firewall.policy 4':
Â

Â
In the above output, the 'date=' and 'time=' attributes indicate that the Firewall Policy 4 ('abc1010') was created on October 10, 2024, at 13:07:20 in the FortiGate local timezone ('tz="+0800"').
Â
Additional notes:
The command execute log filter category supports multiple log categories. The available category values and their corresponding log types are displayed in the following output:
Â

Â
In FortiOS 7.6 and 8.0, event logs can also be filtered by using the named category event. Additional filters, such as subtype or logid followed by the appropriate log ID, can be used to narrow the results when more precise event filtering is required.
Â
execute log filter category event
execute log filter field subtype system
execute log filter field logid <logid number>
execute log displayÂ
For more in-depth information on the available log filters and how to use them with CLI log display, refer to the following Community KB article: Technical Tip: Displaying logs via FortiGate's CLI.
