rlm_sql_log. accounting and locking

2007-12-07 Thread Phil Mayers

All,

The rlm_sql_log module only logs a single query; unlike the main sql 
module which (for accounting) will do an update or insert if not found.


How, if at all, are people merging the rows? Triggers? Post-processing?

Also, I doubt it will be an issue, but just wanted to check; is the 
flock() of the file likely to cause any contention issues? Is there an 
easy way of hashing the NAS-IP-Address to writing to 26 files named 
sql-log-[a-z] and asking radsqlrelay to replay them all?


Thoughts welcome.

Regards,
Phil
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: rlm_sql_log. accounting and locking

2007-12-07 Thread Alan DeKok
Phil Mayers wrote:
 The rlm_sql_log module only logs a single query; unlike the main sql
 module which (for accounting) will do an update or insert if not found.

  It's difficult to do that without interacting directly with the DB.

  Using the 'detail file and radrelay functionality may be safer.

 How, if at all, are people merging the rows? Triggers? Post-processing?
 
 Also, I doubt it will be an issue, but just wanted to check; is the
 flock() of the file likely to cause any contention issues? Is there an
 easy way of hashing the NAS-IP-Address to writing to 26 files named
 sql-log-[a-z] and asking radsqlrelay to replay them all?

  No idea...

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: rlm_sql_log. accounting and locking

2007-12-07 Thread Nicolas Baradakis
Phil Mayers wrote:

 The rlm_sql_log module only logs a single query; unlike the main sql 
 module which (for accounting) will do an update or insert if not found.
 
 How, if at all, are people merging the rows? Triggers? Post-processing?

Indeed rlm_sql_log executes a single SQL statement. However you could
use more complex statements than the config example. For example you
have the INSERT ... ON DUPLICATE KEY UPDATE syntax since MySQL 4.1
or stored procedures since MySQL 5.0.

 Also, I doubt it will be an issue, but just wanted to check; is the 
 flock() of the file likely to cause any contention issues? Is there an 
 easy way of hashing the NAS-IP-Address to writing to 26 files named 
 sql-log-[a-z] and asking radsqlrelay to replay them all?

Don't worry too much about the lock. rlm_sql_log is locking the sql-relay
file and radsqlrelay is locking sql-relay.work therefore the lock should
never block. It's only there to catch a corner case where the file is
renamed before rlm_sql_log finishes writing.

I note rlm_sql_log and radsqlrelay are interacting exactly the same way
as rlm_detail and radrelay do.

-- 
Nicolas Baradakis

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html