Project

General

Profile

Actions

Bug #15373

closed
JP

Firewall Logs Dashboard widget update interval does not behave as expected

Bug #15373: Firewall Logs Dashboard widget update interval does not behave as expected

Added by Jim Pingle over 2 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Dashboard
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
24.11
Release Notes:
Default
Affected Version:
Affected Architecture:

Description

The update interval on the dashboard widget does not behave as expected. It appears to have a problem with any interval which is not a multiple of 5 seconds. This is because the user input interval is divided by 5 and set as the frequency, and then that value is run through a mod operation and only fires if the result is 0.

From log.widget.php:

logsObject.freq = <?=$nentriesinterval?>/5;

From index.php:

                if (((ajaxcntr % freq) === 0) && (typeof ajaxspecs[ajaxidx].callback === "function" )) {
                    make_ajax_call(ajaxspecs[ajaxidx]);
                }

Unless I'm misreading that code, it looks like unless the interval is a multiple of 5 the result of ajaxcntr % freq could never be 0.

So we either need to lock the input to multiples of 5, or fix that calculation so it sets a compatible value for freq.


Files

firewall_log.png (52.1 KB) firewall_log.png GChuf 6, 09/16/2024 08:29 PM

Related issues 2 (0 open2 closed)

Related to Bug #12673: Firewall Logs Dashboard Widget is slow and may fail to updateResolvedJim Pingle

Actions
Related to Bug #15725: Dashboard widgets refresh at unintended intervalsResolvedMarcos M

Actions

JP Updated by Jim Pingle over 2 years ago Actions #1

  • Related to Bug #12673: Firewall Logs Dashboard Widget is slow and may fail to update added

JP Updated by Jim Pingle over 2 years ago Actions #2

  • Plus Target Version changed from 24.07 to 24.08

DZ Updated by Danilo Zrenjanin about 2 years ago Actions #3

  • Status changed from New to Confirmed

Tested against:

24.03-RELEASE (amd64)
built on Mon May 13 15:17:00 MSK 2024
FreeBSD 15.0-CURRENT

I was able to reproduce this. When I set the update interval to 9 seconds, the widget did not update for a few minutes. However, the setup worked as expected when I changed the interval to 10 seconds. Adding seconds to time records in the Firewall Logs Dashboard widget would be helpful.

JP Updated by Jim Pingle almost 2 years ago Actions #4

  • Related to Bug #15725: Dashboard widgets refresh at unintended intervals added

G6 Updated by GChuf 6 almost 2 years ago Actions #5

I was also able to reproduce the problem.
From what I can tell you're reading the code correctly Jim ...
I think the obvious thing here is to get rid of the division. I don't think any other widgets divide the frequency input so modulo works as intended.

I applied the fix in this PR: https://github.com/pfsense/pfsense/pull/4699 and tested it (after I've applied the fixes in #15725).
I also made another commit to display seconds as suggested by Danilo, which seems very reasonable to me.

The widget seems to behave normally now (tested with 6 seconds, v2.7.2):

G6 Updated by GChuf 6 almost 2 years ago Actions #6

  • Status changed from Confirmed to Feedback
  • % Done changed from 0 to 100

Applied in changeset commit:3d89c2dbe73fb081833700c49fec7004b120cd6a.

JP Updated by Jim Pingle almost 2 years ago Actions #7

  • Subject changed from Firewall Logs Dashboard Widget update interval does not behave as expected to Firewall Logs Dashboard widget update interval does not behave as expected

JP Updated by Jim Pingle almost 2 years ago Actions #8

  • Plus Target Version changed from 24.08 to 24.11

CC Updated by Christopher Cope almost 2 years ago Actions #9

  • Status changed from Feedback to Resolved

Tested on

24.11-ALPHA (amd64)
built on Fri Oct 18 15:52:00 UTC 2024
FreeBSD 15.0-CURRENT

It's refreshing correctly on all tested intervals, including ones not divisible by 5. Marking resolved.

Actions

Also available in: Atom