Get Daily Usage: Repeat Question

Selahattin Cilek selahattin_cilek at
Sun Dec 2 19:29:34 CET 2018

To be able to achieve your goal, you must first understand what RADIUS is all about, then what FreeRADIUS does *not*, then what it *does* and then how it does it.

If configured to do so, FreeRADIUS can receive accounting data from NASes (switch, access point etc) and log and save the incoming data either in flat files or on a database. (MySQL being the most favourite...)

It is not a difficult thing to do what you want if you use MySQL. If you check the "/usr/local/etc/raddb/mods-config/sql/main/mysql/queries.conf" file, there is a special section named "accounting".  Under that section, you'll find the SQL queries called by FreeRADIUS when it receives an accounting packet from a NAS. You can modify the queries to suit your particular requirements. What I did was to create a stored procedure for each of those accounting tasks and take care of the complexity of accounting within the database.

The most important query under that section is "interim-update". Mine looks like this:

interim-update {
            query = "CALL accounting_update ('%{Acct-Session-Id}','%{Called-Station-Id}','%{Calling-Station-Id}','%{Acct-Session-Time}','%{Acct-Input-Octets}','%{Acct-Input-Gigawords}','%{Acct-Output-Octets}','%{Acct-Output-Gigawords}')"

Here, "CALL" is a SQL keyword to run a stored procedure on the database, "accounting_update" is the name of the stored procedure and all its parameters are FreeRADIUS tokens. (Note they all start with %.)

Of course, what you need is knowledge of MySQL. You must be able to create  and manage a database. FreeRADIUS offers no help in the way of keeping records.

A word of caution: You'll find that many NASes fail miserably when it comes to RADIUS accounting, so you will have to deal with the incorrect data sent by the NASes and also the annoying "anonymous" identity problem. In addition, you must disable TLS session caching, since it is known to enable users to bypass any accounting constraints you might have in place.

Good luck.

Selahattin ÇİLEK
CRATIS Networking

On 02-Dec-18 20:28, Imdad Hasan wrote:

Dear All,

I am going to repeat my question because i not got the reply of my question
which i asked before 3.5 Months ago. If any have the solution or idea then
please reply.

*Question: How can i make daily usage report with freeradius.*

I got a idea earlier from the *freeradius user list, *But that fails on one


Say for example:

if any user "XYZ" have a one accounting session with the
acct-start-time = "2018-08-16
05:00:00" and acct-stop-time = " 2018-08-19 11:16:46". Ok. Means only one
accounting session 3 days. So, in this example how can i calculate OR get
the "2018-08-17" OR "2018-08-18" s' data usage of that  "XYZ" user?

Warm regards
Imdadali Kadiwala
List info/subscribe/unsubscribe? See

[]<>        Virus-free.<>

More information about the Freeradius-Users mailing list