Changing format for $RAD_REQUEST{'Event-Timestamp'} in Perl module
Юрий Иванов
format_hub at outlook.com
Fri Jun 4 15:24:09 CEST 2021
Thanks for help to everyone.
My main problem was perl code changin to $RAD_CHECK{'Tmp-Integer-0'}") works for me in perl module.
There are some issues with second string date example:
&Tmp-String-0 := "%{date_chdb: request:Event-Timestamp}" and $RAD_CHECK{'Tmp-String-0'} returns empty string
Nevertheless integer works and I hope that overall perfomance with integer date will be better than with strings because looks like raw integer values are inserted in DB without problems.
________________________________
От: Freeradius-Users <freeradius-users-bounces+format_hub=outlook.com at lists.freeradius.org> от имени Alan DeKok <aland at deployingradius.com>
Отправлено: 4 июня 2021 г. 15:41
Кому: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
Тема: Re: Changing format for $RAD_REQUEST{'Event-Timestamp'} in Perl module
On Jun 4, 2021, at 7:58 AM, Юрий Иванов <format_hub at outlook.com> wrote:
> 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}"
> }
That copies the time as an integer value.
> 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}"
> }
That puts the time as a string into an integer value. That won't work.
> 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:
If only there was some kind of debug output you could show.
Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
More information about the Freeradius-Users
mailing list