Changing format for $RAD_REQUEST{'Event-Timestamp'} in Perl module
Юрий Иванов
format_hub at outlook.com
Fri Jun 4 13:58:49 CEST 2021
Thanks for your reply but your example isn't working.
Moreover I've tried date module to tranform date to more db friendly format and this is not working too:
This config:
../default
accounting {
update control {
&Tmp-Integer-0 := "%{integer: request:Event-Timestamp}"
}
perl
or this
file ../mods-enabled/date
date date_chdb {
format = "%Y-%m-%dT%H:%M:%S"
}
../default
update control {
&Tmp-Integer-0 := "%{date_chdb : request:Event-Timestamp}"
}
perl
With perl date
sub accounting {
&radiusd::radlog(L_INFO, "Timestamp: $RAD_REQUEST{'Tmp-Integer-0'}");
return RLM_MODULE_OK;
}
Leads to empty output in logs:
Fri Jun 4 09:47:21 2021 : Info: rlm_perl: Timestamp:
Fri Jun 4 09:47:21 2021 : Info: rlm_perl: Timestamp:
Fri Jun 4 09:47:21 2021 : Info: rlm_perl: Timestamp:
Thanks in advance.
________________________________
От: Freeradius-Users <freeradius-users-bounces+format_hub=outlook.com at lists.freeradius.org> от имени Benjamin Thompson <b.thompson at latera.ru>
Отправлено: 27 мая 2021 г. 9:50
Кому: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
Тема: Re: Changing format for $RAD_REQUEST{'Event-Timestamp'} in Perl module
On Wed, 26 May 2021 at 12:04, Юрий Иванов <format_hub at outlook.com> wrote:
>
> I need to change $RAD_REQUEST{'Event-Timestamp'} format before inserting
> to database.
> Looks like $RAD_REQUEST{'date:Event-Timestamp'},
> $RAD_REQUEST{'integer:Event-Timestamp'} are not working.
>
You can do it in unlang before calling perl:
update control {
&Tmp-Integer-0 := "%{integer: request:Event-Timestamp}"
}
perl
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
More information about the Freeradius-Users
mailing list