RES: FR 3 Event-Timestamp wrong format and Mysql FROM_UNIXTIME error
lscrlstld
lscrlstld at gmail.com
Mon Aug 6 14:09:24 CEST 2012
> lscrlstld wrote:
> > I´m making initial tests with FR 3 (from git) using default configs with
> > mysql db, but have mysql error.
> >
> > Debug info:
> > rlm_sql_mysql: MySQL error 'You have an error in your SQL syntax; check
> the
> > manual that corresponds to your MySQL server version for the right
> syntax to
> > use near '5 2012 23:25:16 BRT), acctupdatetime =
> > FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT)' at line 1'
> > rlm_sql (sql): Released connection (4)
>
> What are the lines BEFORE that?
(2) sql : Creating session using 'accounting_start_query'
(2) sql : expand: INSERT INTO radacct
(acctsessionid, acctuniqueid, username,
realm, nasipaddress, nasportid,
nasporttype, acctstarttime, acctupdatetime,
acctstoptime, acctsessiontime, acctauthentic,
connectinfo_start, connectinfo_stop, acctinputoctets,
acctoutputoctets, calledstationid, callingstationid,
acctterminatecause, servicetype, framedprotocol,
framedipaddress) VALUES ('%{Acct-Session-Id}',
'%{Acct-Unique-Session-Id}', '%{SQL-User-Name}',
'%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}',
'%{NAS-Port-Type}', FROM_UNIXTIME(%{Event-Timestamp}),
FROM_UNIXTIME(%{Event-Timestamp}), NULL, '0',
'%{Acct-Authentic}', '%{Connect-Info}', '', '0',
'0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '',
'%{Service-Type}', '%{Framed-Protocol}',
'%{Framed-IP-Address}') -> INSERT INTO radacct
(acctsessionid, acctuniqueid, username, realm,
nasipaddress, nasportid, nasporttype,
acctstarttime, acctupdatetime, acctstoptime,
acctsessiontime, acctauthentic, connectinfo_start,
connectinfo_stop, acctinputoctets, acctoutputoctets,
calledstationid, callingstationid, acctterminatecause,
servicetype, framedprotocol, framedipaddress)
VALUES ('00000004501F2B13', '58b529eb9a3fbf276615adc21fcc781a',
'usertest', '', '172.31.250.96', '4', '',
FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT), FROM_UNIXTIME(Aug 5
2012 23:25:16 BRT), NULL, '0', '', '', '', '0',
'0', '200.2XX.2XX.XXX', 'usertest', '', 'Framed-User', '',
'10.13.10.1')
(2) sql : expand: /var/log/freeradius/sqltrace.sql ->
/var/log/freeradius/sqltrace.sql
rlm_sql (sql): Reserved connection (4)
rlm_sql (sql): Executing query
rlm_sql_mysql: query: INSERT INTO radacct
(acctsessionid, acctuniqueid, username,
realm, nasipaddress, nasportid,
nasporttype, acctstarttime, acctupdatetime,
acctstoptime, acctsessiontime, acctauthentic,
connectinfo_start, connectinfo_stop, acctinputoctets,
acctoutputoctets, calledstationid, callingstationid,
acctterminatecause, servicetype, framedprotocol,
framedipaddress) VALUES ('00000004501F2B13',
'58b529eb9a3fbf276615adc21fcc781a', 'usertest',
'', '172.31.250.96', '4', '', FROM_UNIXTIME(Aug 5
2012 23:25:16 BRT), FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
NULL, '0', '', '', '', '0', '0', '200.2XX.2XX.XXX',
'usertest', '', 'Framed-User', '', '10.13.10.1')
rlm_sql_mysql: MYSQL check_error: 1064 received
rlm_sql (sql): Database query error 'You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near '5 2012 23:25:16 BRT), FROM_UNIXTIME(Aug 5
2012 23:25:16 BRT), NULL, '0', ''' at line 1' in query '
INSERT INTO radacct (acctsessionid, acctuniqueid,
username, realm, nasipaddress,
nasportid, nasporttype, acctstarttime, acctupdatetime,
acctstoptime, acctsessiontime, acctauthentic,
connectinfo_start, connectinfo_stop, acctinputoctets,
acctoutputoctets, calledstationid, callingstationid,
acctterminatecause, servicetype, framedprotocol,
framedipaddress) VALUES ('00000004501F2B13',
'58b529eb9a3fbf276615adc21fcc781a', 'usertest',
'', '172.31.250.96', '4', '', FROM_UNIXTIME(Aug 5
2012 23:25:16 BRT), FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
NULL, '0', '', '', '', '0', '0', '200.2XX.2XX.XXX',
'usertest', '', 'Framed-User', '', '10.13.10.1')'
rlm_sql_mysql: MYSQL check_error: 1064 received
rlm_sql_mysql: Cannot store result
rlm_sql_mysql: MySQL error 'You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near '5 2012 23:25:16 BRT), FROM_UNIXTIME(Aug 5 2012
23:25:16 BRT), NULL, '0', ''' at line 1'
(2) sql : Failed creating session, updating session using
'accounting_start_query_alt'
(2) sql : expand: UPDATE radacct SET
acctstarttime = FROM_UNIXTIME(%{Event-Timestamp}),
acctupdatetime = FROM_UNIXTIME(%{Event-Timestamp}),
connectinfo_start = '%{Connect-Info}' WHERE acctsessionid =
'%{Acct-Session-Id}' AND username = '%{SQL-User-Name}'
AND nasipaddress = '%{NAS-IP-Address}' -> UPDATE radacct SET
acctstarttime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
acctupdatetime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
connectinfo_start = '' WHERE acctsessionid = '00000004501F2B13'
AND username = 'usertest' AND nasipaddress =
'172.31.250.96'
(2) sql : expand: /var/log/freeradius/sqltrace.sql ->
/var/log/freeradius/sqltrace.sql
rlm_sql (sql): Executing query
rlm_sql_mysql: query: UPDATE radacct SET
acctstarttime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
acctupdatetime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
connectinfo_start = '' WHERE acctsessionid = '00000004501F2B13' AND
username = 'usertest' AND nasipaddress =
'172.31.250.96'
rlm_sql_mysql: MYSQL check_error: 1064 received
rlm_sql (sql): Database query error 'You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near '5 2012 23:25:16 BRT), acctupdatetime =
FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT)' at line 1' in query ' UPDATE
radacct SET acctstarttime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
acctupdatetime = FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT),
connectinfo_start = '' WHERE acctsessionid = '00000004501F2B13'
AND username = 'usertest' AND nasipaddress =
'172.31.250.96''
rlm_sql_mysql: MYSQL check_error: 1064 received
rlm_sql_mysql: Cannot store result
rlm_sql_mysql: MySQL error 'You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near '5 2012 23:25:16 BRT), acctupdatetime =
FROM_UNIXTIME(Aug 5 2012 23:25:16 BRT)' at line 1'
rlm_sql (sql): Released connection (4)
(2) [sql] = fail
(2) Finished request 2.
Waking up in 0.3 seconds.
> > The %{Event-Timestamp} used in query have a wrong date/time format, it
> is
> > not the timestamp.
>
> Yes. That's why the "master" branch uses %{integer:Event-Timestamp},
> which causes the timestamp to be printed as a Unix 32-bit number.
>
> > Is it a dependency of OS setup? How this variable (Event-Timestamp) is
> > generated?
>
> The default config should work.
>
I´m using all default. For some reason the Event-Timestamp have the wrong
format, I can see it in the sqltrace.sql too.
More information about the Freeradius-Users
mailing list