Using accounting data for quotas

Jonathan Gazeley jonathan.gazeley at
Fri Feb 13 11:56:14 CET 2009

I'm trying to find a way to extract useful data from accounting logs to 
use towards a quota. I'm a bit stuck and I'm wondering if anyone has 
tried anything similar with success. Let me explain...

My accounting logs are sent to SQL with the inner ID. Periodically, the 
NAS updates the accounting record with total of upload and download 
during that session. I've tweaked the FR queries so they also update a 
new field called 'lastupdatetime'.

I want to write an hourly script that will tell me (eg in a CSV file) 
how much traffic has been done for each username (not necessarily each 
session) during the last hour. Clearly this will take some sort of 
hourly summary that can be compared each hour. But it is still not 

- Some sessions remain open for weeks.
- Some users have multiple simultaneous or multiple sequential sessions.
- The updates come in at different times.
- The traffic counters will roll over from time to time.
- It's not possible to query hourly on how traffic the user has used 
since forever, because records older than around 90 days are dropped.

Any ideas? Or am I barking up completely the wrong tree...


Jonathan Gazeley
Systems Support Specialist
ResNet | Wireless & VPN Team
Information Services
University of Bristol

More information about the Freeradius-Users mailing list