Use Event-Timestamp for Accounting Start/Stop with MySQL

Alan DeKok aland at deployingradius.com
Tue Dec 21 10:26:03 CET 2010


Juri Glaß wrote:
> I would like to write the Event-Timestamp from Accounting Start/Stop messages to my MySQL database instead of the server side time.
> 
> I tried to configure the dialup.conf, but it doesn't work properly.
> 
> I replaced %S with %{Event-Timestamp}, the result is "0000-00-00 00:00:00" in the database, the log file says :
> expand:  UPDATE radacct SET acctstoptime = '%{Event-Timestamp}',   ** snip **  -> UPDATE radacct SET acctstoptime = 'Dec 21 2010 10:02:30 CET'  ** snip **

  i.e. the Event-Timestamp is not in an SQL format.  That's why the %S
variable exists.

> When I use something like DATE_FORMAT(date,format) from MySQL, the format string is somehow expanded. FROM_UNIXTIME isn't working either.
> 
> I understand that unix timestamps are printed as strings like 'Dec 21 2010 10:02:30 CET', but only for logging or for the sql statements too?

  For everything, unfortunately.  They cannot currently be printed as
32-bit integers.  Maybe in 2.1.11.

  Alan DeKok.



More information about the Freeradius-Users mailing list