sql_log

Peter Nixon listuser at peternixon.net
Sat Sep 2 00:47:44 CEST 2006


On Sat 02 Sep 2006 00:14, Alan DeKok wrote:
> Nicolas Baradakis <nbk at sitadelle.com> wrote:
> > The module has it's own section because you're not supposed to
> > configure both rlm_sql and rlm_sql_log at the same time. However,
> > according to your SQL clean up idea, this section could be in a
> > separate file etc/raddb/sql/sql_log.conf instead of radiusd.conf.
>
>   Sounds good to me.
>
>   If we can have sql_log re-use the queries from the sql config, that
> would be great!  Maybe have sql_log as a sub-type of SQL, rather than
> a separate module?

The simplest way to clean this up immediately is to replace:

#       sql_log {
#               path = ${radacctdir}/sql-relay
#               acct_table = "radacct"
#               postauth_table = "radpostauth"
#
#               Start = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
#                NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
#                AcctSessionTime, AcctTerminateCause) VALUES                 \
#                ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
#                '%{Framed-IP-Address}', '%S', '0', '0', '');"
#               Stop = "INSERT INTO ${acct_table} (AcctSessionId, UserName,  \
#                NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
#                AcctSessionTime, AcctTerminateCause) VALUES                 \
#                ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
#                '%{Framed-IP-Address}', '0', '%S', '%{Acct-Session-Time}',  \
#                '%{Acct-Terminate-Cause}');"
#               Alive = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
#                NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
#                AcctSessionTime, AcctTerminateCause) VALUES                 \
#                ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
#                '%{Framed-IP-Address}', '0', '0', '%{Acct-Session-Time}','');"
#
#               Post-Auth = "INSERT INTO ${postauth_table}                   \
#                (user, pass, reply, date) VALUES                            \
#                ('%{User-Name}', '%{User-Password:-Chap-Password}',         \
#                '%{reply:Packet-Type}', '%S');"
#       }

with:

#       sql_log {
#               path = ${radacctdir}/sql-relay
#               acct_table = "radacct"
#               postauth_table = "radpostauth"

#               $INCLUDE ${confdir}/sql/mysql-dialup.conf
#       }

This should require about 4 lines of changes the sql_log to 
recognise "accounting_start_query " instead of "Start" etc and immediately 
gives a simple way to handle different SQL variants.

On the other hand, I think the cleaner way would be to make sql_log a driver 
for rlm_sql.

-- 

Peter Nixon
http://www.peternixon.net/
PGP Key: http://www.peternixon.net/public.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20060902/b8da44d2/attachment.pgp>


More information about the Freeradius-Devel mailing list