Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
kimeeeed
New Contributor

FortiAnalyzer dataset query questions

Hi, I'm using fortianlyzer and have a question during dataset creation for report output.

I wrote the query below to create a forticlient uuid for the logged-in vpn user and it works fine.
Below is an example of a table made of query statements and queries.

 

- select user, fctuid from $log where $filter and ( ( ( lower(logid) = lower('0107045124'))))

abf1b07a-11dc-4dc6-9e6a-487dc839f207.png

 

Here, the user name is different, and I want to put a condition so that only the same line with the fctuid value is output, but it doesn't work well 

 

GROUP BY fctuid
HAVING COUNT (DISTINCT user) > 1 I tried adding this section but it doesn't work well.

1 Solution
kimeeeed
New Contributor

hello, @Anthony_E 

 

I solved this problem with a sub query. Please refer to the query below

 

SELECT
from_itime(itime) AS itime,
`user`,
`fctuid`
FROM
$log
WHERE
$filter
AND (((lower(logid) = lower('0107045124'))))
AND `fctuid` IN (
SELECT `fctuid`
FROM $log
WHERE $filter
AND (((lower(logid) = lower('0107045124'))))
GROUP BY `fctuid`
HAVING COUNT(DISTINCT `user`) > 1
)
ORDER BY
`id`,
`itime`

View solution in original post

5 REPLIES 5
Anthony_E
Community Manager
Community Manager

Hello,


Thank you for using the Community Forum. I will seek to get you an answer or help. We will reply to this thread with an update as soon as possible.


Thanks,

Anthony-Fortinet Community Team.
Anthony_E
Community Manager
Community Manager

Hello,

 

We are still looking for someone to help you.

We will come back to you ASAP.


Regards,

Anthony-Fortinet Community Team.
Anthony_E
Community Manager
Community Manager

Hi @vraev,

 

Could you please have a look?

Anthony-Fortinet Community Team.
kimeeeed
New Contributor

hello, @Anthony_E 

 

I solved this problem with a sub query. Please refer to the query below

 

SELECT
from_itime(itime) AS itime,
`user`,
`fctuid`
FROM
$log
WHERE
$filter
AND (((lower(logid) = lower('0107045124'))))
AND `fctuid` IN (
SELECT `fctuid`
FROM $log
WHERE $filter
AND (((lower(logid) = lower('0107045124'))))
GROUP BY `fctuid`
HAVING COUNT(DISTINCT `user`) > 1
)
ORDER BY
`id`,
`itime`

Anthony_E
Community Manager
Community Manager

Hello,

 

Thanks a lot for sharing it with us!!

 

Regards,

Anthony-Fortinet Community Team.
Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors