Created on
12-06-2023
09:53 PM
Edited on
09-23-2024
02:50 AM
By
Murat_Dadasoglu
The article describes how to use the generic free-text filter in FortiAnalyzer to filter log forwarding.
FortiAnalyzer.
In Log Forwarding the Generic free-text filter is used to match raw log data. It uses POSIX syntax, escape characters should be used when needed.
In this example, FortiAnalyzer is forwarding logs where the policy ID is not equal to 0 (implicit deny).
Value is set to: user==admin AND (msg ~ "Add" OR msg ~ "Delete").
The sender FortiAnalyzer is only forwarding the logs where the user 'admin' added and deleted administrator accounts.
Note 1:
The generic free-text filter can also be configured from FortiAnalyzer CLI:
config system log-forward
edit 1
set mode forwarding
set server-name "FAZ"
set server-addr "172.31.200.138"
set log-filter-status enable
config log-filter
edit 1
set field free-text
set oper match
set value "policyid!=0"
next
edit 2
set field free-text
set oper match
set value "user==admin AND (msg ~ \"Add\" OR msg ~ \"Delete\")"
next
edit 3
set field free-text
set oper match
set value "appcat==Video/Audio"<----- Filtering logs where the application category is Video/Audio.
next
end
next
end
Note 2:
In GUI, quotations can be used for a specific item, not for the whole value (In CLI it automatically inserts the quotation for the whole value).
For example: If cannot use ("appcat==Video/Audio") in GUI it will give an error for an invalid value. But using (appcat=="Video/Audio") will work.
Note 3:
Generic text filters are also used in Event handlers.
To create an event handler using the Generic Text Filter to match raw log data:
Note 4:
The "equal to" / "==" does not support the subnet filter and "contain" / "~" must be used instead.
Example for acceptable filter for 10.0.0.0/8 subnet using the free-text is: srcip ~ "10\.[0-9]+\.[0-9]+\.[0-9]+"
Related documents:
Technical Note: Use of Operators in Event Handler General Filter (syntax)
Technical Note: How to configure an Event Handler with a generic text filter
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.