FortiAnalyzer event handler trigger
You can trigger automation stitches based on FortiAnalyzer event handlers. This allows you to define rules based on complex correlations across devices, log types, frequencies, and other criteria.
To set up a FortiAnalyzer event handler trigger:
- Configure a FortiGate event handler on the FortiAnalyzer
- Configure FortiAnalyzer logging on the FortiGate
- Configure an automation stitch that is triggered by a FortiAnalyzer event handler
Configure a FortiGate event handler on the FortiAnalyzer
On the FortiAnalyzer, configure an event handler for the automation stitch. In this example, the event handler is triggered when an administrator logs in to the FortiGate. See Creating a custom event handler in the FortiAnalyzer Administration Guide for more information.
To configure an event handler on the FortiAnalyzer:
- Go to FortiSoC > Handlers > FortiGate Event Handlers, and click Create New.
- Configure an event handler with two conditions for the automation stitch:
Log Type
Event Log
Log Subtype
System
Group By
Device ID
Logs match
Any of the following conditions
Log Field
Level
Match Criteria
Equal To
Value
Information
Log Field
Action
Match Criteria
Equal To
Value
login
- Configure the other settings as needed.
- Click OK.
Configure FortiAnalyzer logging on the FortiGate
See Configuring FortiAnalyzer for more information.
To configure FortiAnalyzer logging in the GUI:
- Go to Security Fabric > Fabric Connectors and double-click the FortiAnalyzer Logging card.
- Ensure the Status is Enabled, and configure the settings as needed.
- Click OK.
To configure FortiAnalyzer logging in the CLI:
config log fortianalyzer setting set status enable set server "10.6.30.250" set serial "FL-4HET000000000" set upload-option realtime set reliable enable end
Configure an automation stitch that is triggered by a FortiAnalyzer event handler
When a FortiAnalyzer event handler is triggered, it sends a notification to the FortiGate automation framework, which generates a log and triggers the automation stitch.
To configure an automation stitch that is triggered by a FortiAnalyzer event handler in the GUI:
- Go to Security Fabric > Automation and click Create New.
- Enter the stitch name, auto-faz-1.
- Configure the trigger:
- Click Add Trigger.
- Click Create and select FortiAnalyzer Event Handler.
- Enter the following:
Name
auto-faz-1
Event handler name
system-log-handler2
Event severity
Medium
Event tag
User login successful
- Click OK.
- Select the trigger in the list and click Apply.
- Configure the Email notification action:
- Click Add Action.
- Click Create and select Email.
- Enter the following:
Name
auto-faz-1_email
To
Enter an email address
Subject
CSF stitch alert
Body
User login FortiGate successfully.
- Click OK.
- Select the action in the list and click Apply.
- Click OK.
To configure an automation stitch that is triggered by a FortiAnalyzer event handler in the CLI:
- Create an automation trigger:
config system automation-trigger edit "auto-faz-1" set event-type faz-event set faz-event-name "system-log-handler2" set faz-event-severity "medium" set faz-event-tags "User log in successful" next end
- Create an automation action:
config system automation-action edit "auto-faz-1_email" set action-type email set email-to "admin@fortinet.com" set email-subject "CSF stitch alert" set message "User login FortiGate successfully." next end
- Create the automation stitch:
config system automation-stitch edit "auto-faz-1" set trigger "auto-faz-1" config actions edit 1 set action "auto-faz-1_email" set required enable next end next end
View the trigger event log
To view the trigger event log in the GUI:
- Log in to the FortiGate.
The FortiAnalyzer sends a notification to the FortiGate automation framework, generates an event log on the FortiGate, and triggers the automation stitch.
- Go to Log & Report > Events and select System Events. From the log location dropdown, select FortiAnalyzer.
To view the trigger event log in the CLI:
# execute log display ... date=2019-02-05 time=14:16:17 logid="0100046600" type="event" subtype="system" level="notice" vd="root" eventtime=1549404977 logdesc="Automation stitch triggered" stitch="auto-faz-1" trigger="auto-faz-1" from="log" msg="stitch:auto-faz-1 is triggered." ...
Sample email
The email sent by the action will look similar to the following: