Use Event-Timestamp for Accounting Start/Stop with MySQL

Ramon J. Castillo ramon at
Wed Dec 22 21:14:49 CET 2010

My 2 cents...

Might not be the best way but for now it works...

in the DDL schema.sql

evttime_utcepstop varchar(30) NULL default NULL

evttime_utcepstop (Would be our column in the Mysql DB to store the 
Event-Time-Stamp Attr Radius '55')

I don't need it in the start so I added in the INSERT in the 
"accounting_start_query" conf file dialup.conf: but the value is "" 
I was more interested in the stop.
So.. In the "accounting_stop_query" I changed the update  and included 

evttime_utcepstop  = '%{Event-Timestamp}' \

Yes it is a string for example "Dec  7 2010 00:14:54 UTC" ( my server locale is 

then in a very straight forward sql you can do something like:
select unix_timestamp(str_to_date(evttime_utcepstop, "%b %d %Y %T"));

That way you will get back your EPOCH.

I thought in the possibility of convert it before at the time of the update but 
I rather to not spend the time in the realtime and instead in the post 

Hope it helps


----- Original Message ----
From: Eddie Stassen <estassen at>
To: FreeRadius users mailing list <freeradius-users at>
Sent: Tue, December 21, 2010 2:58:53 PM
Subject: Re: Use Event-Timestamp for Accounting Start/Stop with MySQL

On Tue, Dec 21, 2010 at 3:28 PM, Alan DeKok <aland at> wrote:
> Eddie Stassen wrote:
>> 2.1.10 allows you to use "{%Event-Timestamp#}"  to get date type
>> attributes printed in numeric format.  It doesn't seem to be
>> documented, but its in the code.
> $ man unlang
>  It's there.
Thanks, I was looking at the web man page at, which I now notice is
not quite up to date.

>  There's enough stuff in the server that I'm starting to forget what it
> can do.

Thats one of the best parts of programming - looking over your old
code and finding all the awesome stuff you did and already forgot
about ;-)
>  Alan DeKok.
> -
> List info/subscribe/unsubscribe? See

List info/subscribe/unsubscribe? See

More information about the Freeradius-Users mailing list