Changing format for $RAD_REQUEST{'Event-Timestamp'} in Perl module

Alan DeKok aland at deployingradius.com
Fri Jun 4 14:41:36 CEST 2021


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.




More information about the Freeradius-Users mailing list