SQL Logging wont expand filename

Dean Smith dean at eatworms.org.uk
Mon Nov 13 00:40:13 CET 2017


Using FreeRADIUS Version 3.0.15 from the packages at
https://launchpad.net/~freeradius/+archive/ubuntu/stable-3.0 on Ubuntu 16.04
<https://launchpad.net/~freeradius/+archive/ubuntu/stable-3.0%20on%20Ubuntu%
2016.04> 

 

Using the SQL Module to create a log of SQL queries for access-accept/reject
and accounting packets. However, the filename used is the un-expanded
version (sql-log-%Y%m%d). The queries are logged as expected, and all the
expansion of the content is fine. The expansion of the ${logdir} works - and
the debug shows the date being expanded, however the file written is without
the expansion

 

Other modules (detail) are correctly writing to similar filenames in the
same directory

 

Config :-

mods-enabled/sql-log :-

 

sql sql_log {

        driver="rlm_sql_null"

        dialect="mysql"

        logfile = ${logdir}/sql-relay-%Y%m%d

        $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries-relay.conf

}

 

mods-config/sql/main/mysql/queries-relay.conf 

post-auth {

       log_table = "radlog"

        query = "INSERT INTO ${log_table} set \

                stamp=%l, \

                nas='%{Client-IP-Address}/%{NAS-IP-Address}', \

                port='%{NAS-Port}', \

                type='%{reply:Packet-Type}', \

                username='%{User-Name}', \

                clid='%{Calling-Station-Id}', \

                hg='%{Huntgroup-Name}', \

                info='%{Connect-Info}', \

 
tun='%{reply:Tunnel-Server-Endpoint[0]}-%{reply:Tunnel-Server-Endpoint[1]}'
\

        "

}

 

sites-enabled/n3server.cfg

postauth {

                sql_log

                Post-Auth-Type REJECT {

                                sql_log

                }

}

 

Debug :-

0) sql_log: EXPAND .query

(0) sql_log:    --> .query

(0) sql_log: Using query template 'query'

rlm_sql (sql_log): Reserved connection (0)

(0) sql_log: EXPAND %{User-Name}

(0) sql_log:    --> testsql

(0) sql_log: SQL-User-Name set to 'testsql'

(0) sql_log: EXPAND INSERT INTO radlog set              stamp=%l,
n
as='%{Client-IP-Address}/%{NAS-IP-Address}',            port='%{NAS-Port}',
t
ype='%{reply:Packet-Type}',             username='%{User-Name}',
c
lid='%{Calling-Station-Id}',            hg='%{Huntgroup-Name}',
i
nfo='%{Connect-Info}',
tun='%{reply:Tunnel-Server-Endpoint[0]}-%{reply:
Tunnel-Server-Endpoint[1]}'

(0) sql_log:    --> INSERT INTO radlog set              stamp=1510527623,
n
as='10.1.1.30/10.1.1.30',               port='0',
type='Access-Acc
ept',           username='testsql',             clid='',
hg='', i
nfo='',                 tun='-'

(0) sql_log: EXPAND /space/radmin/log/sql-relay-%Y%m%d

(0) sql_log:    --> /space/radmin/log/sql-relay-20171112

(0) sql_log: Executing query: INSERT INTO radlog set
stamp=1510527623
,               nas='10.1.1.30/10.1.1.30',              port='0',
t
ype='Access-Accept',            username='testsql',             clid='',
h
g='',           info='',                tun='-'

(0) sql_log: SQL query returned: success

(0) sql_log: 1 record(s) updated

rlm_sql (sql_log): Released connection (0)

(0)         [sql_log] = ok

 

FileListing :-

-rw-rw----  1 n3radius n3radius   43373 Nov 12 23:00 sql-relay-%Y%m%d

-rw--w----  1 n3radius n3radius  879393 Nov 12 23:00 detail-20171112

 

Any suggestions ?



More information about the Freeradius-Users mailing list