Periodic Data Usage Reporting

Alan DeKok aland at
Thu Apr 7 13:33:23 UTC 2022

On Apr 4, 2022, at 12:33 AM, Max James <xxedlxx101 at> wrote:
> I have followed the below "Periodic Data Usage Reporting" article found on
> the freeradius wiki.
> I am using the postgresql process-radacct.sql script which can be found on
> the freeradius-server github.

  That's from the "master" branch, but I suppose it should work for v3, too.

> The implementation was successful and works as expected, however I did
> notice an issue that I can't seem to figure out myself.
> If a users session ends and a new one begins, the next time the
> fr_new_data_usage_period() function is executed, it seems to be inserting
> the data usage for that entire session instead of only the data usage that
> was accrued since the last time the function was executed.

  Yes, it sets the total usage time for all closed sessions, and adds in the time for the current session.

> The function reports usage as expected until it comes across users that
> have a new session since the function was last executed. I've spent a few
> hours trying to figure out the cause but I've had no luck. Any advice or
> help is much appreciated. Thanks in advance.

  I'm not sure what's wrong here.  The table is updated with the total value of session time.  That's what it's supposed to do?

  Alan DeKok.

More information about the Freeradius-Devel mailing list