Filtering accounting messages

Alan DeKok aland at deployingradius.com
Sun Jul 14 20:27:04 CEST 2019


On Jul 14, 2019, at 2:02 PM, liran kessel <lirankessel at gmail.com> wrote:
> I am receiving accounting messages from the network and storing them to the radacct table. 
> Currently in order to filter I have changed the INSERT/UPDATE commands with a where statement to only insert rows for subscribers I am managing.

  Hmm... that works, but isn't the most efficient.

> This is working fine but as my network grows it is creating a lot of overhead to execute SQL commands that don’t do anything and so I am trying to move the filtering to the FreeRADIUS code.

  That's good.

> I have added the preacct to the attr_filter file:

  I'm not sure why.  The attr_filter module will filter (i.e. delete) attributes in a packet.  It won't change how many times SQL is being called.

> However it seems that the filter is being ignored and all lines are inserted to the DB.

  Yes.

> Can you please assist in understanding why it isn’t filtering?

  Because filter attributes is not the same as skipping SQL.

> In addition if I have a list of about 100K subscribers that I do want to store their accounting data to the DB is there a way to manage this list without adding it 1 by 1 to the filter file?

  Yes.  Presumably there is some check you can do for your own users.  Then, do:

accounting {
	...
	if (my users) {
		sql
	}
	# else not my users, don't do SQL
	...
}

  The only magic here is how to determine what are "my users".  Since that's local to your system, we can't help here.

  Alan DeKok.




More information about the Freeradius-Users mailing list