Hi all
I've implemented various user defined FortiAnalyzer reports via the FortiAnalyzer webinterface. In some cases it would be a lot easier if it would be possible to directly query the database via CLI.
How can I do this? I tried it via the "execute sql-query-generic" command, however it seems the variable $log is not defined in the CLI:
sv1 $ execute sql-query-generic "SELECT count(*) from $log" ERROR: syntax error at or near "$" LINE 1: SELECT count(*) from $log
Which table (view) do I have to query for traffic log via CLI?
Thanks
Rene
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
There is no plan to add query support to the CLI. However we will look into the API support for the query.
Could you please elaborate on what cases that you might need this kind of support?
Thanks,
L
Hi Rene,
You can not query logs directly from CLI, but you can run dataset under CLI.
For example, create a dataset "test" on GUI, then run sql-query-dataset under cli
execute sql-query-dataset <adom> <dataset-name> <device/group name> <faz/dev> <start-time> <end-time>
sample query:
FAZVM64 # exe sql-query-dataset root test All_FortiGates faz "2015-05-01 00:00:00" "2015-06-01 00:00:00"
Regards,
Huai Zhao
hzhao_FTNT wrote:Ok, thank you. I will try this next Monday.You can not query logs directly from CLI, but you can run dataset under CLI.
For example, create a dataset "test" on GUI, then run sql-query-dataset under cli
execute sql-query-dataset <adom> <dataset-name> <device/group name> <faz/dev> <start-time> <end-time>
sample query:
FAZVM64 # exe sql-query-dataset root test All_FortiGates faz "2015-05-01 00:00:00" "2015-06-01 00:00:00"
Hi
It is already possible to execute SQL commands via CLI ("execute sql-query-generic sql"). However the variable $log is not available in CLI.
What do you mean by API support?
The problem is some of my user defined reports do not work on the FortiAnalyzer (Bugfix is pending). So I have to manually query some data from the database. This is a lot easier if it could be done via CLI...
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1712 | |
1093 | |
752 | |
447 | |
231 |
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 2024 Fortinet, Inc. All Rights Reserved.