Query error in Acct table for Tenant_ID
Emrah Yıldırım
emrah.yldrm81 at gmail.com
Thu Mar 22 07:56:00 CET 2018
Tenant_list the "tenant_list " Freeradius service does not work if you do
not capitalize the initials. I did great with your knowledge. Currently the
service worked
I added the attribute as follows. The tenant_id number of data coming from
the captive portal to the Radacct table is ' 0 '.
Actually, it was worth 1.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PhpMyAdmin
Tenant_List Acct-Session-Id
Acct-Unique-Session-Id {SQL-User-Nam
2509 0 1a4670265078e308
d95e03d919d03623407adbe4ebe55239
emrah 192.168.22.188 2012 Ethernet 2018-03-22 08:35:31
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
start {
#
# Insert a new record into the sessions table
#
query = "\
INSERT INTO ${....acct_table1} \
(${...column_list}) \
VALUES \
('%{Tenant_List}', \
'%{Acct-Session-Id}', \
'%{Acct-Unique-Session-Id}', \
'%{SQL-User-Name}', \
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#ATTRIBUTE My-Local-String 3000 string
#ATTRIBUTE My-Local-IPAddr 3001 ipaddr
#ATTRIBUTE My-Local-Integer 3002 integer
ATTRIBUTE Tenant_List 3000 string
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Log traffic to an SQL database.
#
# See "Accounting queries" in sql.conf
update request {
Tenant_List = %{sql:"SELECT tenant_id FROM nas WHERE realipaddr =
'%{NAS-IP-Address}'"}
}
sql
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2018-03-21 21:16 GMT+03:00 Alan Buxey <alan.buxey at gmail.com>:
> hi,
>
>
> > accounting {
> >
> > #
> > # See "Accounting queries" in sql.conf
> >
> > update request {
> > tenant_list = %{sql:"SELECT tenant_id FROM ${client_table}
> > WHERE realipaddr = '%{NAS-IP-Address}'"}
> > }
>
> okay.....
>
> > Unknown attribute "tenant_list"
>
> so did you add that value to the dictionary?
>
>
> no, you didnt.
>
> you then went on to add something completely different and irrelevant
> "Tenant-Id-List" - seen in your next email.
>
> worse, you then went and did something random, sticking stuff back
> into queries.conf
>
> ...and you've got syntax errors in your insert statement - "VALUES
> (%{Tenant-Id-List}', %{Acct-Session-Id}',
> '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id...." - you're missing
> a load of apostrophes for those initial elements. basic SQL 101.
>
> alan
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/
> list/users.html
>
More information about the Freeradius-Users
mailing list