Hi,
I was trying to figure out how I can subtract "from_dtime(dtime)" of "now()" and count the interval in days.
I was wondering if somebody knows.
Tks folks.
Solved! Go to Solution.
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.
I see, then pls try to_char((now() - from_dtime(dtime)), 'DD') as interval
Please try:
select (case when (date(now()) - date(from_dtime(dtime))) > 90 then 'More than 90 days' else to_char( (now() - from_dtime(dtime) ), 'DD') end) as interval, devid, msg from $log where msg like 'Fortigate started' and subtype='system' and level='information' and msg is not null and $filter ORDER BY interval ASC limit 1
regards,
hz
then:
select (case when (date(now()) - date(from_dtime(dtime))) < 90 then to_char( (now() - from_dtime(dtime) ), 'DD') else 'More than 90 days' end) as interval, devid, msg from $log where msg like 'Fortigate started' and subtype='system' and level='information' and msg is not null and $filter ORDER BY interval ASC limit 1
AFAIK, it is not possible to do it, chart can not automatically change column number or customize "No matching log data for this report".
Hi, we have predefined $day_of_month and $day_of_week, please check it out.
Regards,
hz
I'm trying to do something like that:
select now() - from_dtime(dtime) as interval, devid, msg from $log where msg like 'Fortigate started' and subtype='system' and level='information' and msg is not null ORDER BY interval DESC limit 1
But when I print "now()", I'm getting a date without timezone.
I see, then pls try to_char((now() - from_dtime(dtime)), 'DD') as interval
Great!
It worked really fine.
Another doubt...
How can I ignore "Time Period" ?
$filter contains device and time filter, do not recommend to ignore it.
It's because I need to search for every single log message referring to the "Fortigate started", regardless of the "Time Period" setted.
Any ideas?
Hi, I think you can select "custom..." for a longer time period.
hz
Ok. The query looked like this:
select to_char( (now() - from_dtime(dtime) ), 'DD') as interval, devid, msg from $log where msg like 'Fortigate started' and subtype='system' and level='information' and msg is not null and $filter ORDER BY interval ASC limit 1
Is possible to create a condition, for example, if the Days be more than 90 days or N/A then print 'More than 90 days' instead of printing the number of the days? But if it less than 90 days, keep showing in Days.
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 |
---|---|
1733 | |
1106 | |
752 | |
447 | |
240 |
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.