Use Event-Timestamp for Accounting Start/Stop with MySQL

Ramon J. Castillo ramon at rcastillo.net
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 
UTC)

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 
processing.

Hope it helps

Ramon

----- Original Message ----
From: Eddie Stassen <estassen at gmail.com>
To: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
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 deployingradius.com> 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
http://freeradius.org/radiusd/man/unlang.html, 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 http://www.freeradius.org/list/users.html
>

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list