How to get UTC time string in XLAT
Hi there I wonder if there's a way to use the rlm_date to get the current time in the format: "2023-03-16T01:09:06Z", i.e. it should also be the time in GMT / UTC and not local time... I need this with rlm_rest to form a JSON request with a current time UTC stamp. Best regards, Till
On Mar 15, 2023, at 10:25 PM, g4-lisz@tonarchiv.ch wrote:
I wonder if there's a way to use the rlm_date to get the current time in the format: "2023-03-16T01:09:06Z", i.e. it should also be the time in GMT / UTC and not local time...
Use a recent version of the server. The date module has a "use_utc" configuration flag. Alan DeKok.
March 16, 2023 1:43 PM, "Alan DeKok" <aland@deployingradius.com> wrote:
On Mar 15, 2023, at 10:25 PM, g4-lisz@tonarchiv.ch wrote:
I wonder if there's a way to use the rlm_date to get the current time in the format: "2023-03-16T01:09:06Z", i.e. it should also be the time in GMT / UTC and not local time...
Use a recent version of the server. The date module has a "use_utc" configuration flag.
Thank you very much Alan for your reply. Sorry for asking this basic question, but how exactly do I use this module? I.e. how looks a XLAT string / placeholder that gives me the current date in a certain format? For most modules there are plenty of examples, but I couldn't find anything about date:... expansion. Best regards + sorry again for asking stupid questions Till
On Mar 16, 2023, at 9:13 AM, g4-lisz@tonarchiv.ch wrote:
Sorry for asking this basic question, but how exactly do I use this module? I.e. how looks a XLAT string / placeholder that gives me the current date in a certain format?
For most modules there are plenty of examples, but I couldn't find anything about date:... expansion.
The module comes with documentation. https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/mods-avail... See "wispr2date", which includes sample configuration, and an example of how to use the module in an xlat string. Alan DeKok.
March 16, 2023 2:15 PM, "Alan DeKok" <aland@deployingradius.com> wrote:
On Mar 16, 2023, at 9:13 AM, g4-lisz@tonarchiv.ch wrote:
Sorry for asking this basic question, but how exactly do I use this module? I.e. how looks a XLAT string / placeholder that gives me the current date in a certain format?
For most modules there are plenty of examples, but I couldn't find anything about date:... expansion.
The module comes with documentation. https://github.com/FreeRADIUS/freeradius-server/blob/v3.2.x/raddb/mods-avail...
See "wispr2date", which includes sample configuration, and an example of how to use the module in an xlat string.
Thank you again! Seems that I looked at an older version of the module setup, where there wasn't the wispr2date part yet. But one question remains: How I get the current time into this expression? In the example it's using an attribute. I guess there is some built in variable for this? Sorry, I couldn't find this information either... Best regards, Till
On Mar 16, 2023, at 10:49 AM, g4-lisz@tonarchiv.ch wrote:
Seems that I looked at an older version of the module setup, where there wasn't the wispr2date part yet.
Which is why I said to use a recent version of the server.
But one question remains: How I get the current time into this expression? In the example it's using an attribute. I guess there is some built in variable for this? Sorry, I couldn't find this information either...
The Event-Timestamp attribute contains a date. Or, You use %t to get the request timestamp. All of this is extensively documented. Alan DeKok.
March 16, 2023 4:01 PM, "Alan DeKok" <aland@deployingradius.com> wrote:
On Mar 16, 2023, at 10:49 AM, g4-lisz@tonarchiv.ch wrote:
Seems that I looked at an older version of the module setup, where there wasn't the wispr2date part yet.
Which is why I said to use a recent version of the server.
But one question remains: How I get the current time into this expression? In the example it's using an attribute. I guess there is some built in variable for this? Sorry, I couldn't find this information either...
The Event-Timestamp attribute contains a date. Or, You use %t to get the request timestamp.
Ah of course Event-Timestamp is obvious! I didn't see the forest for the trees.
All of this is extensively documented.
Yes, if you know, where ;-) Finally I found "Run-time variables" in the Wiki... Best regards Till
participants (2)
-
Alan DeKok -
g4-lisz@tonarchiv.ch