Dear community,
anybody using Fortigate API to retrieve log traffic with this endpoint :
/api/v2/log/disk/traffic/forward/system?filter=srcip==10.227.108.88&rows=10
I can get logs for a specific source or destination IP, but do you know anyway to get logs for a network ( example : 10.0.0.0/8) ?
Running version :
"version":"v7.2.10",
"build":1706
Thanks in advance for your help ;)
Looking the FortiDev documentation, only available filters are the following, but they didn't make the trick to filter on network after several test :
filter array[string] (query) | Filtering multiple key/value pairs |
Solved! Go to Solution.
Looking at 7.2 GUI, I see a filter set to destination = 10.1.0.0/24 translated to dstip=@"10.1.0.0-10.1.0.255" , can you try that?
Thanks @pminarik , it made the trick !!!
For 15 rows of the log result, filtering on "srcip"
curl -k "https://XXXXXXXXXXX/api/v2/log/memory/traffic/forward?filter=srcip=@"10.65.0.0-10.65.0.255"&rows=15&access_token=XXXXXXXXXXXXXXX" | jq '.results[].srcip'
"10.65.0.6"
"10.65.0.5"
"10.65.0.5"
"10.65.0.4"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.3"
"10.65.0.4"
"10.65.0.6"
"10.65.0.4"
"10.65.0.3"
"10.65.0.46"
Hi,
In theory, you should be able to use 10.0.0.0/8 supernet with the srcip filter, srcip=10.0.0.0/8 .
You would need to escape the / character and maybe add some quotes or double quotes for it.
At least in logs I can search in the GUI with something like that.
Thanks for your reply @funkylicious !
I get you idea, inspiring from GUI but looks like API is going on his own way :
Several tests giving me random result (no matching the network) :
Double quote, reverse-slash and double equal :
curl -k "https://XXXXX/api/v2/log/memory/traffic/forward?filter=srcip=="10.227.13.0\/24"&rows=10&access_token=xxxxxxx"
Doublequote, reverse-slash and simple equal :
curl -k "https://XXXXX/api/v2/log/memory/traffic/forward?filter=srcip="10.227.13.0\/24"&rows=10&access_token=xxxxxxx"
Doublequote, reverse-slash and simple equal :
curl -k "https://XXXXX/api/v2/log/memory/traffic/forward?filter=srcip="10.227.13.0/24"&rows=10&access_token=xxxxxxx"
Without quote and simple "equal"
Looking at 7.2 GUI, I see a filter set to destination = 10.1.0.0/24 translated to dstip=@"10.1.0.0-10.1.0.255" , can you try that?
Thanks @pminarik , it made the trick !!!
For 15 rows of the log result, filtering on "srcip"
curl -k "https://XXXXXXXXXXX/api/v2/log/memory/traffic/forward?filter=srcip=@"10.65.0.0-10.65.0.255"&rows=15&access_token=XXXXXXXXXXXXXXX" | jq '.results[].srcip'
"10.65.0.6"
"10.65.0.5"
"10.65.0.5"
"10.65.0.4"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.5"
"10.65.0.3"
"10.65.0.4"
"10.65.0.6"
"10.65.0.4"
"10.65.0.3"
"10.65.0.46"
User | Count |
---|---|
2429 | |
1303 | |
778 | |
561 | |
455 |
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.