buffered-sql

In version 2.0.0, radrelay functionality was integrated into the server core. This virtual server gives an example of using radrelay functionality inside of the server.

In this example, the detail file is read and the data is put into SQL. This configuration is used when a RADIUS server on this machine is receiving and writing accounting packets to the detail file.

The purpose of this virtual server is to decouple the storage of long-term accounting data in SQL from the "live" information that is needed by the RADIUS server as it is running.

The benefit of this approach is that for a busy server, the overhead of performing SQL queries may be significant. Also, if the SQL databases are large (as is typical for ones storing months of data), the INSERTs and UPDATEs may take a relatively long time. Rather than slowing down the RADIUS server by having it interact with a database, the packets can simply be logged to a detail file, and that file can be read at a later time when the RADIUS server is lightly loaded.

If one virtual server is used to log to the detail file and another virtual server (i.e., this one) is used to read from the detail file, then this process will happen automatically. A sudden spike of RADIUS traffic means that the detail file will grow in size and the server will be able to handle large volumes of traffic quickly. When the traffic dies down, the server will have time to read the detail file and to insert the data into a long-term SQL database.

The requests are not being proxied, so no pre/post-proxy sections are necessary.

server buffered-sql

listen {
	type = detail
	filename = "${radacctdir}/detail-*"
	load_factor = 10
	poll_interval = 1
	retry_interval = 30
	}

pre-accounting

Decides which accounting type to use.

preacct {
	preprocess

Ensures that we have a semi-unique identifier for every request. Many NAS boxes are broken and don’t set unique identifiers for accounting sessions.

	acct_unique

Reads the 'acct_users' file. This line isn’t always necessary and can be deleted if not in use.

	files

accounting

Logs the accounting data.

accounting {

Logs traffic to an SQL database.

See also "Accounting queries" in sql.conf

#	sql

Cisco VoIP specific bulk accounting.

#	pgsql-voip
}